in reply to Re: Re: Re: sort hashes....
in thread sort hashes....
Arrays have order. You can sort one array and collect the sorted version in another array. It's like a rope upon which all of the elements are tied at various points.
When you say "sort a hash," you really mean, collect the keys or collect some part of the values, and generate a sorted array of those. That is, search through the bag and tie each item onto a rope, until all of the items in the bag are ALSO on the rope.
Often, the first thing you do with this sorted array is to query the hash again, using the sorted array as an ordering guide. That is, following the knots on the rope to visit all of the items in the bag.
I hope the metaphors help.
--
[ e d @ h a l l e y . c c ]
|
|---|