in reply to Sorting a multidimensional hash by column
And remember that you have to store the result in an array and not in a hash, because hashes don't preserve order.