From: dblack@... Date: 2002-10-10T05:24:09+09:00 Subject: Re: strange Hash default behaviour Hi -- On Thu, 10 Oct 2002, Bill Tj wrote: > I am using ruby 1.6.7 (2002-03-01) [i686-linux] and I got the > following: > > hsh = Hash.new ([]) > hsh['a'] << 'a' > puts hsh.length # >> 0 ??? What you're doing is adding 'a' to that default array, rather than setting an 'a' key. So the above is the same as if you had done: hsh = Hash.new(['a']) hsh still doesn't have any keys, just a default value. David -- David Alan Black | Register for RubyConf 2002! home: dblack@candle.superlink.net | November 1-3 work: blackdav@shu.edu | Seattle, WA, USA Web: http://pirate.shu.edu/~blackdav | http://www.rubyconf.com