Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re^3: Processing pairs of values from even-sized array

by AnomalousMonk (Archbishop)
on Jun 03, 2011 at 16:53 UTC ( [id://908021]=note: print w/replies, xml ) Need Help??


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'

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://908021]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (3)
As of 2024-04-16 21:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found