in reply to Modify array elements inside for loops
This looks a little more natural:
my @a = (1 .. 9); # for instance!! for my $e (@a) { my $ee = $e+1; # copy current element }
In any case it's a trade-off. The current way allows you to modify the array in-place while still allowing you to easily, I like split infinitives BTW, use the elements without changing the array. If $e was just a copy it would be much harder to modify the array in-place. That's a good deal I think.
|
|---|