The iteration over a hash with each is not only inefficient, but also wrong. The reason is that the iterations aren't completed, so the next time the while-loop is entered, the the iteration continues where it left off before.
That's because the state of the each-iterator is not tied to a lexical scope, but rather to the hash itself.
In reply to Re^2: Hash search yields unexpected results
by moritz
in thread Hash search yields unexpected results
by mattcsully
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |