No such thing as a small change | |
PerlMonks |
Re: redeclaring variables with 'my'by mirod (Canon) |
on Nov 10, 2000 at 17:16 UTC ( [id://40928]=note: print w/replies, xml ) | Need Help?? |
I think you slightly mis-stated the common construct, it should be:
Otherwise the my $var returns undef which might not be what you want (the loop would not be executed). As far as I know this is perfectly kosher. $var is declared, its scope is the inner block and I would bet (Perl guts Gurus can confirm this) that the whole thing is optimized so the variable is actually built (ie allocated) only once. I'd be interested in knowing what are your local guru arguments.
In Section
Seekers of Perl Wisdom
|
|