in reply to Re: Why Doesn't each() DWIM?
in thread Why Doesn't each() DWIM?

If you have 5.8.3 or later, it's more efficient to use keys %hash; in a void context rather than a scalar context if you only want to reset the iterator.

This avoids the need to calculate the number of keys in the hash, which for large and/or tied hashes can potentially be an expensive operation.


Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham
"Think for yourself!" - Abigail