in reply to Perl oddities
I still find myself being tripped up from time to time by the following, even though I should know better:
my @w= qw/ per coercer berserker / ; print "$_\n" for map { s/er/aler/g } @w;
The above produces the output "1 2 3". To make it DWIM, one must say:
my @w = qw/ per coercer berserker / ; print "$_\n" for map { s/er/aler/g; $_ } @w;
I've always found that odd. (Yes, I know why it works that way).
- another intruder with the mooring in the heart of the Perl
|
|---|