From: Nico Ritsche Date: 2008-01-29T06:39:08+09:00 Subject: Re: Hash Sorting Ilan Berci wrote: > Ilan Berci wrote: > >> >> you can however as James suggested, move the elements to a hash and then >> sort the result any way you want.. >> > errrr.. I mean move the elements to an array.. sorry for the confusion > > ilan Well, yea, but that is what I did, with no success. The hash.sort function simply calls .to_a and then sort on the generated array, so it does exactly what you and James suggested. Unfortunately the array is not sorted when I iterate over it using array.each do ... end Is it because iterating like this doesn't preserve the order of array elements? I assumed .each do iterates in element order. I will test this... -- Posted via http://www.ruby-forum.com/.