From: Sebastian Hungerecker Date: 2007-10-03T19:15:35+09:00 Subject: Re: Hash of arrays - strange behavior. Jakub Kuć·»ma wrote: > Hello, > > Could somebody explain me the following behavior? > > irb(main):001:0> h = Hash.new([]) > => {} > irb(main):002:0> h[1].push(1) > => [1] > irb(main):003:0> h > => {} Hash.new(arg) makes arg the default, but it doesn't assign to the hash. You want h = Hash.new {|h,k| h[k] = []} HTH, Sebastian -- Jabber: sepp2k@jabber.org ICQ: 205544826