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

Re^4: foreach argument modification inside loop, followed by return from loop

by vsespb (Hermit)
on Jul 12, 2013 at 09:00 UTC ( #1043914=note: print w/ replies, xml ) Need Help??


in reply to Re^3: foreach argument modification inside loop, followed by return from loop
in thread foreach argument modification inside loop, followed by return from loop

I found something.

https://groups.google.com/forum/#!searchin/comp.lang.perl.misc/randomizing$20/comp.lang.perl.misc/D8Znz7CbCyg/ZXcyK3OTUEIJ

PerlGuru + something about randomizing array + foreach+splice+last

'If any part of LIST is an array, "foreach" will get very confused > if you add or remove elements within the loop body, for example with > "splice". So don't do that.' > > Your testing seems to prove that this is a special case, certainly a > very useful one. > Please explain what makes it special. The 'last' makes it special. By exiting the loop there is no opportunity for confusion.
But I did not find see "Anyway, don't do it, even with "last"" advices :(


Comment on Re^4: foreach argument modification inside loop, followed by return from loop

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (9)
As of 2015-07-04 17:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (60 votes), past polls