diff options
| author | robbie-hatley <Robbie.Hatley@gmail.com> | 2024-07-30 00:01:06 -0700 |
|---|---|---|
| committer | robbie-hatley <Robbie.Hatley@gmail.com> | 2024-07-30 00:01:06 -0700 |
| commit | 08f88032055299df819d17f760bf328fecab034b (patch) | |
| tree | cc54262ad230c7fd8a1f0c49516b46b9edd69f63 | |
| parent | 58581bb66bd2bc716cc56a0f7f9c1e6a5a919d3a (diff) | |
| download | perlweeklychallenge-club-08f88032055299df819d17f760bf328fecab034b.tar.gz perlweeklychallenge-club-08f88032055299df819d17f760bf328fecab034b.tar.bz2 perlweeklychallenge-club-08f88032055299df819d17f760bf328fecab034b.zip | |
Fixed "uninitialized" problem in 280-1.
| -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}"; } |
