diff options
| -rw-r--r-- | challenge-335/mahnkong/perl/ch-1.pl | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/challenge-335/mahnkong/perl/ch-1.pl b/challenge-335/mahnkong/perl/ch-1.pl index 4a7e42509a..31ee2ef606 100644 --- a/challenge-335/mahnkong/perl/ch-1.pl +++ b/challenge-335/mahnkong/perl/ch-1.pl @@ -4,7 +4,7 @@ use feature 'signatures'; use Test::More 'no_plan'; sub run(@words) { - return undef unless scalar(@words); + return undef if scalar(@words) < 2; my %occurences; my @result; @@ -12,7 +12,7 @@ sub run(@words) { foreach my $c (split //, $words[0]) { if (! exists($occurences{$c})) { my $max_occurences_all; - foreach my $word (@words) { + foreach my $word (@words[1 .. $#words]) { my $occurences = () = $word =~ /$c/gi; $max_occurences_all = $occurences if (!defined $max_occurences_all || $max_occurences_all > $occurences); } |
