Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: How can I skip an element in an array whilst reading...

by tachyon (Chancellor)
on Apr 06, 2002 at 01:58 UTC ( [id://157103]=note: print w/replies, xml ) Need Help??


in reply to How can I skip an element in an array whilst reading...

For a non-destructive method that leaves the original array intact (we use a modulus flip-flop):

for my $i ( 0 .. $#in ) { $i % 2 ? push @out2, $in[$i] : push @out1, $in[$i]; }

Log In?
Username:
Password:

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

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

    No recent polls found