From: ts Date: 2001-12-12T00:26:31+09:00 Subject: [ruby-talk:28229] Re: Hash.keys Q >>>>> "L" == Leo Laursen writes: L> Now options.keys returns ["Password", "Host", "Port", "Name"] L> I would expect ["Host", "Port", "Name", "Password"] L> is there an explanation for this ? Yes, the order of the keys in an Hash depend of the hash function. For example in your case, the order is given by pigeon% cat b.rb #!/usr/bin/ruby ["Password", "Host", "Port", "Name"].each do |key| puts "#{key} -- #{key.hash % 10}" end pigeon% pigeon% b.rb Password -- 2 Host -- 7 Port -- 8 Name -- 9 pigeon% 10 is the default size value when ruby build an Hash Guy Decoux