campbell has asked for the wisdom of the Perl Monks concerning the following question:
I have an array of hashes that looks like this:
({doc1=>2345}, {doc2=>1234}, {doc3=>5678}, {doc4=>4567})
I would like to sort this array of hashes by the values of the keys so that I end up with an array that looks like this:
(doc2, doc1, doc4, doc3)
Help!
Thanks in advance
Campbell
PS: I know that this is similar to a question that has been asked already, but that was to do with hashes that have multiple keys.
I hope, therefore, that the answer to my question will be simpler
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: sorting an array of hashes by the value of the keys
by broquaint (Abbot) on Jun 19, 2003 at 15:11 UTC | |
by diotalevi (Canon) on Jun 19, 2003 at 15:34 UTC | |
|
Re: sorting an array of hashes by the value of the keys
by artist (Parson) on Jun 19, 2003 at 15:13 UTC | |
|
Re: sorting an array of hashes by the value of the keys
by Mr. Muskrat (Canon) on Jun 19, 2003 at 15:22 UTC | |
|
Re: sorting an array of hashes by the value of the keys
by Bilbo (Pilgrim) on Jun 19, 2003 at 15:21 UTC | |
|
Re: sorting an array of hashes by the value of the keys
by campbell (Beadle) on Jun 20, 2003 at 08:30 UTC |