in reply to Basic list manipulation, and a bit of map() confusion...
Is using map here the most efficient way to do this (for much larger lists)?
What kind of problem are you having? Speed? memory? something else?
If you want to reduce your memory footprint, you could use a counting loop and push.
for my $i (0..$#a) { my $s = $a[$i]; $s =~ s/x//g; push @b, $s if $s; }
As for the speed difference between this and your solution, only a benchmark will tell. Should be very similar.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Basic list manipulation, and a bit of map() confusion...
by ysth (Canon) on Feb 24, 2008 at 19:37 UTC | |
by ikegami (Patriarch) on Feb 25, 2008 at 19:23 UTC |