From: Florian Gross Date: 2004-09-18T03:39:45+09:00 Subject: Re: Accessing Hash elements in sorted order? Chris wrote: > cgi = CGI.new > cgi.params.sort.each { |pair| puts "#{pair[0]}=#{pair[1]}" } One small suggestion: cgi.params.sort.each do |(key, value)| puts "#{key}=#{value}" end > Is this *really* the best way to access the elements of Hash in sorted > order? I suppose, if at base, this is the way to do it, I could extend > Hash to abstract this... There has been some discussion going on whether Ruby's Hash should be sorted by default on this list recently. Regards, Florian Gross