Saving the keys in a temporary array could be a very
bad thing to do. It's ok if the hash is small, but
consider the effects if the hash contains a ten million
entries and is tied through some DB* mechanism. Your program
suddenly needs a few additional hundreds of megabytes of
memory. At best, that makes your program slow, or your
program crashes. In the worst case, it makes every other
process running on the box slow.
Abigail