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);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
(jcwren) RE: make a new list by substituting an old list
by jcwren (Prior) on Sep 10, 2000 at 21:39 UTC | |
by merlyn (Sage) on Sep 10, 2000 at 21:49 UTC | |
by jcwren (Prior) on Sep 10, 2000 at 21:52 UTC |