diff options
| -rwxr-xr-x | challenge-280/robbie-hatley/perl/ch-1.pl | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/challenge-280/robbie-hatley/perl/ch-1.pl b/challenge-280/robbie-hatley/perl/ch-1.pl index 3f63719cf5..81bc5654d4 100755 --- a/challenge-280/robbie-hatley/perl/ch-1.pl +++ b/challenge-280/robbie-hatley/perl/ch-1.pl @@ -55,15 +55,15 @@ Output is to STDOUT and will be each input followed by the corresponding output. use v5.38; use utf8; - no warnings 'uninitialized'; sub second ($x) { my %hash; my $char; for my $idx (0..length($x)-1) { - if ($hash{$char=substr($x,$idx,1)}>0){ + $char = substr($x,$idx,1); + ++$hash{$char}; + if (2 == $hash{$char}){ return $char; } - ++$hash{$char}; } return "\x{FFFD}"; } |
