in reply to Re: Re: Simple question about foreach and my.
in thread Simple question about foreach and my.
Depends completely on what I'm going to do with the variable. The overriding principle is that a variable is scoped as tightly as possible.
If the variable is only used within the loop then it should be restricted to within the loop. If I'm going to use it outside the loop then I'll declare it outside the loop.
--
"Perl makes the fun jobs fun
and the boring jobs bearable" - me
|
|---|