Hi,

>From: Lloyd Zusman <ljz / asfast.com>

> Is it possible in ruby to make use of constructs that correspond to
> the following Perl constructs? ...
> 
>   $array[1][2][3] = 'whatever';   # multidimensional array
> 
>   $hash{'a'}{'b'} = 'something';  # multidimensional hash
> 
> I know that I can create classes in ruby which encapsulate this
> behavior, but before I re-invent the wheel, I'd like to know if anyone
> has already come up with things like this in ruby.

  class ArrayMD < Array
    def [](n)
       self[n]=ArrayMD.new if super(n)==nil
       super(n)
    end
  end

  a = ArrayMD.new
  a[1][2][3]="foo"  #=> [nil, [nil, nil, [nil, nil, nil, "foo"]]]

See also  http://www.ir.isas.ac.jp/~masa/ruby/mdary.html

M.Tanaka