On Wed, 17 Apr 2013 11:47:49 -0700, Jim Gibson wrote:
> 1. You should not modify a hash while you are iterating through it with
> the each() function. The each() function uses an internal data structure
> that persists from one call of each to the next. That internal data
> structure can be modified if you add or delete elements (as you are
> doing). 

So the documentation has warned.  Yet it should probably be updated, since 
that behavior has been demonstrated to be safe: https://groups.google.com/
forum/?hl=en&fromgroups#!topic/comp.lang.perl.misc/53Lfj8IM0JQ and there 
is specific code in the internals to make it safe: https://
groups.google.com/forum/?hl=en&fromgroups=#!topic/comp.lang.perl.moderated/
_J9aO8pdAVc

-- 
Peter Scott
http://www.perlmedic.com/     http://www.perldebugged.com/
http://www.informit.com/store/product.aspx?isbn=0137001274
http://www.oreillyschool.com/certificates/perl-programming.php

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to