in reply to Re^2: Processing pairs of values from even-sized array
in thread Processing pairs of values from even-sized array
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'
|
---|