Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Remove array elements dynamically!

by suaveant (Parson)
on Aug 27, 2007 at 20:22 UTC ( [id://635417]=note: print w/replies, xml ) Need Help??


in reply to Remove array elements dynamically!

@array = (1..10); for(my $i=0; $i<@array; $i++) { if($array[$i]%2) { splice(@array,$i,1,()); $i-- #array is one shorter, now; } } print "@array\n";

                - Ant
                - Some of my best work - (1 2 3)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (6)
As of 2024-04-19 15:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found