Offer Kaye [OK], on Wednesday, May 25, 2005 at 09:09 (+0300) typed the
following:

>> it was easy mistake, everything we should know about this is avoid
>> using keys() on %$hr in while loop, because it resets iterator. That's
>> all. 

OK> Well, that, and don't change the hash inside the while loop. In your
OK> original email you wrote:
OK> "and get_something() change the hash"

I was wrong here; get_something() actually doesn't change the hash (if
I'll do that I'll find my mistake sooner, it is also logical).

OK> That's a no-no according to "perldoc -f each": "If you add or delete
OK> elements of a hash while you're iterating over it, you may get entries
OK> skipped or duplicated, so don't."

Trap was using keys. But thanks for remembering this to me and other
members :)

-- 

How do you protect mail on web? I use http://www.2pu.net

[Promote that demon to the House of Lords, commanded Tom imperiously.]



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to