Beefy Boxes and Bandwidth Generously Provided by pair Networks Joe
Perl: the Markov chain saw
 
PerlMonks  

Re: Re: Splice of ref to AoH not removing element

by liz (Monsignor)
on May 30, 2004 at 12:59 UTC ( #357606=note: print w/ replies, xml ) Need Help??


in reply to Re: Splice of ref to AoH not removing element
in thread Splice of ref to AoH not removing element

Adding to or removing from an array you're iterating over is a bad idea. If you create a loop over two elements (indices 0 and 1) and, on the first iteration, remove one element, what will happen on the second iteration?

However, if you would iterate in reverse order (1,0) then there would be no problem at all.

Liz


Comment on Re: Re: Splice of ref to AoH not removing element

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (9)
As of 2014-04-18 07:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (463 votes), past polls