in reply to What's happening to this hash?

When you execute a keys or a values function it resets the internal hash iterator used by each on that hash. That's why the second example works as one would expect.