From: Ian Whitlock Date: 2007-08-21T01:25:02+09:00 Subject: Re: How to implement a hash whose key is another hash? unknown wrote: > Could some explain how to use hash key which is of type hash Perhaps studying this will explain your confusion. require 'pp' test ={} k1 = {"new"=>"girl"} k2 = {"new"=>"girl"} test[k1]= 100 test[k2]= 200 pp k1.eql?(k2) pp test test ={} test[k1]= 100 test[k1]= 200 pp test Note that each instance of "new"=>"girl" is a different hash object. Basing the key on a hash does not look like a good idea in general. Consider what happens when you extend k1. k1 = {"new"=>"girl"} test ={} k1["bad"]="idea" test[k1]= 100 k1["bad"]="idea" test[k1]= 200 pp test Keys should be stable objects. Ian Whitlock -- Posted via http://www.ruby-forum.com/.