Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: getting hash key with value

by oko1 (Deacon)
on Apr 16, 2008 at 02:11 UTC ( [id://680718]=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://680718]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (6)
As of 2024-04-19 10:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found