in reply to Processing pairs of values from even-sized array
Why not just:
while(@arr) { my ($x,$y) = (shift(@arr), shift(@arr)); ... }
Update: ... looks [like] the each generator ...
Maybe (see List::MoreUtils):
use List::MoreUtils qw(natatime); ;; my $it = natatime 2, @arr; while (my ($x, $y) = $it->()) { ... }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Processing pairs of values from even-sized array
by rovf (Priest) on Jun 03, 2011 at 13:47 UTC |