in reply to Magical data modification using $_
Footnote to ikegami's reply. I found this, when I was hacking in some code on auto-pilot and ended up with my($_) instead of the intended local($_):
perl -e '@a=qw(a b c d e); for my $_ (@a){&f;print "$_\n"};sub f {$_=uc($_)}'This indeed protects the caller from falling victim to a careless $_ use in a subroutine. Works in 5.10, but not in 5.8.
|
|---|