From: Robert Dober Date: 2007-07-23T18:13:03+09:00 Subject: Re: how to make a[2][3]=4 work? On 7/23/07, Fsormok Fsormok wrote: > > a = Hash.new{|h,k| h[k]=Hash.new &h.default_proc} > > > irb(main):026:0> require 'ostruct' > > irb(main):027:0> int = Hash.new{|h,k| h[k]=OpenStruct.new} > > >a = {} > > ==>{} > >a[1] = 1 > > ==>1 > >a[ [2,1] ] = 2 > > ==>2 > >a[ [2,2,3] ] = 4 > > ==>4 > >p a > >{[2, 2, 3]=>4, [2, 1]=>2, 1=>1} > > ==>nil > > Tanks for the replies. > > I'm just a little bit confused because in ruby everything is lean and > clean but when it comes to hashes of hashes it gets kind of complicated. > For me it looks like ruby has another "concept" of solving such things. > Hmm the context of this statement seems not complete in *this* thread, maybe you could elaborate on this a little bit? Personally I feel that Ruby's concept of Hashes is clearcut and exactly the same as in most of its relatives (Perl,Python...). What exactly would you like to have "simpler"? Cheers Robert -- As simple as possible, but not simpler. -- A. Einstein