in reply to Re: array with s///g command
in thread array with s///g command
my @array2 = map { s/\s+//g; $_ } @array1;
Update Whoops, now I see ... it's because you'd be changing the original array. Still, I like the brevity of something like:
my @array2 = map { (my $x = $_) =~ s/\s+//g; $x } @array1;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: array with s///g command
by GrandFather (Saint) on Jul 30, 2007 at 00:28 UTC |