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
    Thanks a lot to you - and all the other ones who replied to my post! I was so focused on the idea having the declaration of my $x and $y inside the loop clause, that I didn't see this obvious solution!

    -- 
    Ronald Fischer <ynnor@mm.st>