in reply to Re: for loop localisation bug?
in thread for loop localisation bug?

Your post gave me some ideas. How about emulating BrowserUk's foreach, for devil's sake, with something like:

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.