Dotfiles, utilities, and other apparatus.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
402 B

  1. #!/usr/bin/perl
  2. use strict;
  3. use warnings;
  4. use Text::GenderFromName;
  5. use 5.10.0;
  6. my ($male, $female, $unknown) = (0, 0, 0);
  7. while (my $name = <STDIN>) {
  8. chomp $name;
  9. my $gender = gender($name);
  10. if (! defined $gender) {
  11. $unknown++;
  12. next;
  13. }
  14. if ($gender eq 'm') {
  15. $male++;
  16. } elsif ($gender eq 'f') {
  17. $female++;
  18. }
  19. }
  20. say "male: $male, female: $female, unknown: $unknown";