in reply to getting hash key with value

In my experience, whenever I find myself with a need/question of this sort, it usually means that my data structure was incorrectly designed from the start. Often, adding another variable - an array, or a second hash, or (if the keys and the values are easily told apart) additional members in the original hash - during the data collection/aggregation part of the process takes care of the problem, and does not require doubling the space.

If for some reason you really do need a one-to-one correspondence - that is, you have two sets of data in which you must be able to look up a corresponding member for every element - then a simple hash is probably not what you want.

Human history becomes more and more a race between education and catastrophe. -- HG Wells