in reply to Nested while each over a hash -> infinite loop

You can only have one iterator per a hash. When you call each in the inner loop, you get undef (end of iteration), next call to each (in the outer loop again) starts again from the beginning. If you want two iterators, make a copy of the hash.