The following code changes contents of array @a:
Which is the best (most effective) way to make sure that no code inside the loop will modify array contents? I'm looking for a way to make the list not to be assignable.use strict; use Data::Dumper; my @a = qw(1 2 3); print Dumper(\@a); for my $b (@a) { $b *= 2; } print Dumper(\@a);
--dda
In reply to Preserve array contents in for() loop by dda
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |