my $n; for (my @tmp = (LIST); @tmp ? ($n = shift @tmp) || 1 : 0;) {...} print "Last \$n is: $n\n";
The tradeoff is that you're iterating over copies, and you won't get aliasing.
In reply to Re: Re: for loop localisation bug?
by calin
in thread for loop localisation bug?
by BrowserUk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |