in reply to Re: What would you do?
in thread What would you do?
Not quite. The first method does not assign to the same $_ that the while loop uses. If it did, you couldn't use $_ in that for loop at all.
japhy -- Perl and Regex Hacker
It's when you start doing silly and dangerous things like:while (<FH>) { # localized $_ for (split ' ') { # localized $_ } # previous $_ }
that problems occur. It is a bad idea to assign to a global $_ -- where "global" means "not localized".sub foo { $_ = shift; # TSK! local $_ tr/aeiou/AEIOU/; return $_; }
japhy -- Perl and Regex Hacker
In Section
Seekers of Perl Wisdom