@{[@array]} makes an anonymous copy so you won't clobber the elements in the original array.my @a = (1 .. 9); # for instance!! for my $e (@{[@a]}) { $e += 1; }
In reply to Re: Modify array elements inside for loops
by MrNobo1024
in thread Modify array elements inside for loops
by sguazt
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |