Gary Wright [2008-01-28 21:07]: > This works for a two-level hash, which is what the OP needed. > > If you want an infinite-level hash: > > lazy = lambda { |h,k| h[k] = Hash.new(&lazy) } > > h = Hash.new(&lazy) you can even do it like this: h = Hash.new { |l, k| l[k] = Hash.new(&l.default_proc) } ;-) > h[1][2][3][4] = 5 > > p h # {1=>{2=>{3=>{4=>5}}}} cheers jens -- Jens Wille, Dipl.-Bibl. (FH) prometheus - Das verteilte digitale Bildarchiv f Forschung & Lehre Kunsthistorisches Institut der UniversitçÕ zu Köìn Albertus-Magnus-Platz, D-50923 Köìn Tel.: +49 (0)221 470-6668, E-Mail: jens.wille / uni-koeln.de http://www.prometheus-bildarchiv.de/