in reply to Re: Processing pairs of values from even-sized array
in thread Processing pairs of values from even-sized array

Have you tried using each itself.
This doesn't work, because this would require $array being a hash reference.

-- 
Ronald Fischer <ynnor@mm.st>

Replies are listed 'Best First'.
Re^3: Processing pairs of values from even-sized array
by AnomalousMonk (Archbishop) on Jun 03, 2011 at 16:53 UTC

    Interestingly, the 5.12+ each allows iteration over an array (and similarly for keys and values), but each 'key' is a succcessive index of the array, and each 'value' is the element at that index: not quite what you wanted in the OP.

    >perl -wMstrict -le "my @ra = qw(a b c d); ;; while (my ($i, $element) = each @ra) { print qq{ra $i is '$element'}; } " ra 0 is 'a' ra 1 is 'b' ra 2 is 'c' ra 3 is 'd'