in reply to Re^6: split every other value
in thread split every other value
Yes, that's the one I was talking about, and yes, you are right. Trying to correct along another line that leads me to another nice solution:
my @field = split /,/, $text; my @even = @field[ map $_ * 2, 0 .. ( @field / 2 ) - 1 ]; my @odd = @field[ map $_ * 2 + 1, 0 .. ( @field / 2 ) - 1 ];
(Despite the two maps, it only iterates once — a half-iteration in each of them.)
Makeshifts last the longest.
|
|---|