Pathologically Eclectic Rubbish Lister | |
PerlMonks |
Re^4: Scope and referencesby {}think (Sexton) |
on Jun 19, 2011 at 18:44 UTC ( [id://910463]=note: print w/replies, xml ) | Need Help?? |
That was it! I had always thought of the FOR loop as a single construct. I didn't realize that each time the control logic ($i++, etc.) is exectuted, you EXIT the brackets and lose that scope! But if you parse the code very precisely, that is literally what happens, so it now makes sense! Thank you BrowserUk!
{}think; #Think outside of the brackets
In Section
Seekers of Perl Wisdom
|
|