From: Gary Wright Date: 2010-02-05T09:08:41+09:00 Subject: Re: Can Ruby Do This? On Feb 4, 2010, at 5:58 PM, Mr Bubb wrote: > In Perl, you can create a hash of arbitrary depth like so: > > $hash->{foo}->{bar}->{baz} = 123; It is a bit tricky because you have to specify a default proc that refers to itself (to get the infinite depth): >> default = lambda { |h,k| h[k] = Hash.new(&default) } => # >> top = Hash.new(&default) => {} >> ?> top[0][1][2][3] = 4 => 4 >> ?> p top {0=>{1=>{2=>{3=>4}}}} => nil Gary Wright