Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: How do I loop through a list two or more elements at a time?

by davorg (Chancellor)
on Oct 24, 2001 at 14:41 UTC ( [id://121070]=note: print w/replies, xml ) Need Help??


in reply to How do I loop through a list two or more elements at a time?

If you don't mind destroying your array in the process, you can use splice.

while (my ($el1, $el2) = splice(@list, 0, 2)) { # do stuff }

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (4)
As of 2024-04-25 16:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found