From each
> The iterator is implicitly reset when each has reached the end as just described; it can be explicitly reset by calling keys or values on the hash or array.
So your DumpFile is internally reseting that counter, probably by calling each ...
As a rule of thumb: Try to avoid calling (unknown) code operating on the iterated structure within a while-each loop.²
That's what I do.
See also this blog , where Reini is discouraging any use of each
I wouldn't go that far, but YMMV. :)
Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)
Je suis Charlie!
²) Otherwise a warning should be emitted IMHO...
In reply to Re: Action on each key/value pair in a hash
by LanX
in thread Action on each key/value pair in a hash
by luxs
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |