|
|
- #!/usr/bin/perl
-
- use strict;
- use warnings;
- use Text::GenderFromName;
- use 5.10.0;
-
- my ($male, $female, $unknown) = (0, 0, 0);
-
- while (my $name = <STDIN>) {
- chomp $name;
- my $gender = gender($name);
- if (! defined $gender) {
- $unknown++;
- next;
- }
-
- if ($gender eq 'm') {
- $male++;
- } elsif ($gender eq 'f') {
- $female++;
- }
- }
-
- say "male: $male, female: $female, unknown: $unknown";
|