# simple literal key only $month = $months{$month} if exists $month{$month}; # more flexible any instance my $re = join '|', map{quotemeta} keys %months; $month =~ s/($re)/$months{$1}/g;
Note you need to quote strings on the RHS of => otherwise Perl will see 08 and complain about your illegal octal.
cheers
tachyon
In reply to Re: Replacing string with number
by tachyon
in thread Replacing string with number
by nejcPirc
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |