No, you're right. It all depends on what the poster wanted to do with the information after they got it. If they just want a list of the values sorted, then sorting on "values %hash" would work. They said they wanted to sort the hash by the values, and that's why I assumed that they still wanted to be able to associate the values to the keys after sorting. Otherwise your only choice is to iterate through the keys for each value until you find one that matches.
-----Original Message----- From: david [mailto:dzhuo@;looksmart.net] Sent: Thursday, November 07, 2002 5:10 PM To: [EMAIL PROTECTED] Subject: RE: Hash Sorting? Timothy Johnson wrote: > > I guess it depends on whether you want the list of keys sorted by which > has > the highest value or the values themselves. The most common use of this > for me is when I want to sort the keys or values of a hash using a hash > reference, for example if I'm calculating people's final scores for a > scoreboard. The values would be useless sorted if I didn't know which key > they went to. Take the following example, where just to mix things up a > little, I've passed a hash reference to my function: > didn't the original poster said the values are unique too? and he said (in particular) that he wants to sort the values right? anyway, i just happen to be surfing around but didn't really read your previous post so i could be wrong... :-) if that's the case, ignore me... david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]