in reply to Re: Simple question about foreach and my.
in thread Simple question about foreach and my.
You need to be very careful using this idiom, especially
if you're hoing to embed loops. It's very easy to mix up
which $_ belongs to which loop and create
some horrendous problems.
In general I find it's better to name (and declare) the iteration variables unless it's really going to be a short loop (in which case I tend to use the statement modifier expr for (@array) in any case)
In Section
Seekers of Perl Wisdom