|There's more than one way to do things|
I Ordered My Keys With Existing Values!by abitkin (Monk)
|on Jul 28, 2003 at 14:54 UTC||Need Help??|
abitkin has asked for the wisdom of the Perl Monks concerning the following question:
Okay, so here's the deal
I need a data structure that will store 2-7 data points (these points will be numbers from 0-50 with none repeated) in such a way as to preserve the order of the data points, and to make look up on a specific point easy.
I'm going to address the second part first, to make this easy for me, I'm tempted to put these items into a hash and use exists. eg.
While this would be an ideal solution for finding a key quickly, trying to order the data based on the values associated with those keys seems to be quite a bit of extra effort. Eg.
Now this wouldn't be so bad, but it may be done on a number of hashes like this. Does anyone see a better way?
Kwyjibo. A big, dumb, balding North American ape. With no chin.