I would expect that this would print out "30" in the end, but instead it prints out "45". It appears that some implicit localization is going on with "$i". I knew this happened with "$_" but is this supposed to happen with all variables? Is this documented anywhere?use strict; my $i = 45; my $x; my $end = 30; for $i (0..67) { # do some useful stuff last if $i == $end; } print $i."\n";
In reply to "for" surprise by fletcher_the_dog
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |