Its cheap to reset an itterator, just do keys %foo; before the C<each> loop.
Just wondering, is keys() optimized for void context? Perlfunc only states:
As a side effect, calling keys() resets the HASHâ¤s internal iterator...
If it is _not_ optimized for void context, I think it's "easy" to reset rather than "cheap" ;-)
If keys() _is_ optimized for void context, a change in the perlfunc.pod seems to be in order.
Liz