in reply to Re^2: Make array from field of another array
in thread Make array from field of another array
my @new_array = map { (split /:/)[3] } @old_array;
Note that I have relied on split's default of splitting $_ when not provided with an explicit string. So the above is exactly equivalent to
my @new_array = map { (split /:/, $_)[3] } @old_array;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Make array from field of another array
by Saved (Beadle) on Apr 07, 2011 at 17:14 UTC | |
|
Re^4: Make array from field of another array
by Saved (Beadle) on Apr 07, 2011 at 17:17 UTC | |
|
Re^4: Make array from field of another array
by Saved (Beadle) on Apr 07, 2011 at 18:35 UTC |