From: John Carter Date: 2004-06-28T13:57:34+09:00 Subject: Re: N Dimensional Hash? On Thu, 24 Jun 2004, Jim Freeze wrote: > Hi > > I'm looking for an object that behaves like a > n-dimensional hash. We'll start with two dimensions > to make this easy. An idiom I quite often use is... a = Hash.new {|hash,key| hash[key]=Hash.new(0)} Although in your case you may want something like... a = Hash.new {|hash,key| hash[key]={}} or a = Hash.new {|hash,key| hash[key]=Hash.new{|h,k| h[k]={}}} I just love ruby. Of course, you could fall back on the old "awk" standby... key = %w{a b c d} hash = {} hash[key.join("#")]=whatever John Carter Phone : (64)(3) 358 6639 Tait Electronics Fax : (64)(3) 359 4632 PO Box 1645 Christchurch Email : john.carter@tait.co.nz New Zealand The universe is absolutely plastered with the dashed lines exactly one space long.