There is one little exception. Taking the snippet from roundboy's and modifying it slightly, we get this code which allows you to have 2 same-named, but 2 differently-scoped variables and differenciate between them in a nested loop. I tried manipulating this to work with $_, but it just won't happen. :) Note that you have to put in more work to use this than simply using 2 differently named variables. And this is ugly lol.
for our $x (1..2) { for my $x (3..4) { print "$::x, $x\n"; } }
If the above content is missing any vital points or you feel that any of the information is misleading, incorrect or irrelevant, please feel free to downvote the post. At the same time, please reply to this node or /msg me to inform me as to what is wrong with the post, so that I may update the node to the best of my ability.
In reply to Re: Loop 'for' and '$_'.
by Coruscate
in thread Loop 'for' and '$_'.
by nite_man
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |