in reply to Action on each key/value pair in a hash

Expanding on what beech said

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!

Update

²) Otherwise a warning should be emitted IMHO...