Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re^2: How can I delete an element in a foreach cycle?

by jasonk (Parson)
on Mar 02, 2010 at 04:35 UTC ( #826071=note: print w/ replies, xml ) Need Help??


in reply to Re: How can I delete an element in a foreach cycle?
in thread How can I delete an element in a foreach cycle?

Or just go backwards...

for my $i ( reverse 0 .. $#ARGV ) { splice( @ARGV, $i, 1 ) if $ARGV[$i] eq 'hello'; }

www.jasonkohles.com
We're not surrounded, we're in a target-rich environment!


Comment on Re^2: How can I delete an element in a foreach cycle?
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (17)
As of 2014-10-23 13:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (125 votes), past polls