On Tue, Jun 21, 2011 at 4:34 PM, Iñáki Baz Castillo <ibc / aliax.net> wrote: > Hi, I want to order a hash using itds keys: > > ¨Âòâ²½¾¢²¢³½¾¢³¢±½¾¢±¢ > ¨Âòâá®óïòô > ¨ÂÛ±¢±¢ÝÛ²¢²¢ÝÛ³¢³¢Ý> > But I want a resulting hash with keys ordered: > > ¨Â ±½¾¢±¢²½¾¢²¢³½¾¢³¢> > Is there any efficiente way? (I don't want the hast to be converted to > an array and the to a hash again). See Adam's and Josh's replies: a Hash is generally unordered. However, what do you need this for? If it is for debugging purposes then you might as well override #inspect on a per instance basis or change it in Hash (not recommended). If you need that for other reasons then maybe a tree might be a better choice. There is for example http://raa.ruby-lang.org/project/ruby-rbtree/ Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/