That's just because you're doing it inside out. Much simpler to use a foreach loop, as shown in this snippet.@new = map { my $x = $_; $x =~ s/foo/bar/g; $x } @old;
s/foo/bar/g for (@new = @old); - or - tr/A-Z/N-ZA-M/ for (@new = @old);
In reply to make a new list by substituting an old list by merlyn
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |