diff options
| -rwxr-xr-x | challenge-194/perlboy1967/perl/ch-1.pl | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/challenge-194/perlboy1967/perl/ch-1.pl b/challenge-194/perlboy1967/perl/ch-1.pl index 4b4638403d..8826c9ba6b 100755 --- a/challenge-194/perlboy1967/perl/ch-1.pl +++ b/challenge-194/perlboy1967/perl/ch-1.pl @@ -25,11 +25,11 @@ use Test::More; sub highestDigit ($) { state $c = { -1=>-1, 0=>2, 1=>9, 2=>-1, 3=>5, 4=>9 }; - $c->{index($_[0],'?')} + ($_[0] =~ y/?/?/) != 1 ? -1 : $c->{index($_[0],'?')} } -my %t = qw(?0:00 2 1?:00 9 10:?2 5 12:1? 9); +my %t = qw(?0:00 2 1?:00 9 10:?2 5 12:1? 9 ??:00 -1 00?00 -1); for (sort keys %t) { is(highestDigit($_),$t{$_},"highestDigit('$_')"); |
