in reply to Preserve array contents in for() loop
For making a temporary array, I like this idiom, though there's no performance reason to prefer it to any other:for (@a) { my $b = $_; # Or do a deep copy, if necessary $b *= 2; }
others preferfor my $b (map $_, @a) { $b *= 2; }
for my $b (@{[@a]}) {
|
|---|