http://www.perlmonks.org?node_id=1023538


in reply to Re^3: Is it safe to append to the array you are iterating over
in thread Is it safe to append to the array you are iterating over

I disagree with your 'for no good reason' part. In my use case, I have a very good reason to want this to happen. (I mean the real code I'm working on, not the baby example I used in the OP). I'm using it to traverse a tree of nodes and build a list (actually a hash) of data about the nodes.

But as I said in another comment, I'm switching to using an implementation that uses a while loop instead that's clearly safer.

--DrWhy

"If God had meant for us to think for ourselves he would have given us brains. Oh, wait..."