Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
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 musing on the Monastery: (15)
As of 2014-10-21 13:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (103 votes), past polls