diff options
| -rw-r--r-- | challenge-160/maxim-kolodyazhny/perl/ch-1.pl | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/challenge-160/maxim-kolodyazhny/perl/ch-1.pl b/challenge-160/maxim-kolodyazhny/perl/ch-1.pl index bdb4c1ebca..e4acdc0543 100644 --- a/challenge-160/maxim-kolodyazhny/perl/ch-1.pl +++ b/challenge-160/maxim-kolodyazhny/perl/ch-1.pl @@ -6,8 +6,7 @@ use v5.20; $_ = pop; my @n = qw( 0 one two three four five six seven eight nine ); -my %l = map { $a++, length } @n; - -1while s/[^4]$/$n[$&] is $n[$l{$&}], $l{$&}/; +sub l { length @n[@_] } +1while s/[^4]$/$n[$&] is $n[l $&], ${\l $&}/; say ucfirst s/4/four is magic./r |
