in reply to split every other value
This is one way:
my $ra_all = [ [], [] ]; map { push @{$ra_all->[$_ % 2]}, $_ } @array; my @evens = @{$ra_all->[0]}; my @odds = @{$ra_all->[1]};
Regards,
PN5
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: split every other value
by Prior Nacre V (Hermit) on Aug 07, 2004 at 00:29 UTC | |
by Aristotle (Chancellor) on Aug 07, 2004 at 00:38 UTC | |
by Prior Nacre V (Hermit) on Aug 07, 2004 at 01:56 UTC |