Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

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

by tachyon (Chancellor)
on Oct 24, 2001 at 21:18 UTC ( [id://121200]=note: print w/replies, xml ) Need Help??


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

{cough} you could always use the obvious approach with a C style loop

@ary = qw( a b c d e f g h i ); for ( my $i=0; $i<@ary; $i=$i+2 ) { print "$ary[$i] - $ary[$i+1]\n"; }

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (8)
As of 2024-04-24 10:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found