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!for (my $i=0; $i <=1; $i++) { #new scope in brkts }
In reply to Re^4: Scope and references
by {}think
in thread Scope and references
by {}think
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |