Do you know where your variables are? | |
PerlMonks |
Re: redeclaring variables with 'my'by ChOas (Curate) |
on Nov 10, 2000 at 17:09 UTC ( [id://40927]=note: print w/replies, xml ) | Need Help?? |
Why does he say it is bad behaviour ? okay, I have to admit that some compilers 'n stuff are not that smart and start allocing and de-allocing variables right aways when out of scope (not so handy when you're redeclaring IN a loop that runs a million times or so) But, initialising a new var in the while of the loop is not that bad I think, it's just local to the loop, declared once, and out of scope out of your loop... works for me.. By the way... while (my $Var) is NOT initialising, $Var is allocated as undef, then processed by the while, verified as not true, and the code in the while will never run But then again... what do I know....
In Section
Seekers of Perl Wisdom
|
|