How about using splice?
knoppix@Microknoppix:~$ perl -E ' > @arr = ( 1 .. 6 ); > while ( @arr ) > { > ( $x, $y ) = splice @arr, 0, 2; > say qq{$x - $y}; > }' 1 - 2 3 - 4 5 - 6 knoppix@Microknoppix:~$
I hope this is helpful.
Cheers,
JohnGG
In reply to Re: Processing pairs of values from even-sized array
by johngg
in thread Processing pairs of values from even-sized array
by rovf
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |