in reply to Re: Processing pairs of values from even-sized array
in thread Processing pairs of values from even-sized array
Something I've needed in the past was to get two arrays (odds and evens).
You can also push onto two arrays using a ternary.
knoppix@Microknoppix:~$ perl -E ' > push @{ $_ % 2 ? \ @odds : \ @evens }, $_ for 1 .. 8; > say qq{ Odds : @odds}; > say qq{Evens : @evens};' Odds : 1 3 5 7 Evens : 2 4 6 8 knoppix@Microknoppix:~$
I hope this is of interest.
Cheers,
JohnGG
In Section
Seekers of Perl Wisdom