From: David Naseby Date: 2004-03-03T14:33:01+09:00 Subject: Re: why are Hashes so unsorted? what's your solution? >From: Ruby Baby [mailto:ruby@hitmedia.com] > >In PHP, this is no problem. I get the hash, and I can do the >"each" iteration on it, and get my top-selling albums in order. > >In Ruby, it's an unordered jumble. > >Why is that? > >And what do you think is the Ruby way solution for what I need to do? Simplest solution: use an ordered hash implementation, such as rbtree (http://raa.ruby-lang.org/list.rhtml?name=ruby-rbtree). Hashes are unordered pretty much by definition (a convenient definition can be found at http://en.wikipedia.org/wiki/Hash_table). Its possible that PHP hashes, by default, are rb-tree based. David Naseby http://homepages.ihug.com.au/~naseby/