Ken Bloom wrote: > On Sat, 03 Nov 2007 15:44:48 -0500, sepp2k wrote: > >>> gives me a nil error! >> >> blk = lambda {|h,k| h[k] = Hash.new(&blk)} x = Hash.new(&blk) >> x[:la][:li][:lu][:chunky][:bacon][:foo] = "bar" >> >> >> HTH, >> Sebastian > > sepp2k's answer is the only correct answer in this thread. > Darn it! I knew someone would spot the error here: x = Hash.new {|hash, key| hash[key] = {} } x[:bla][:some_key] = true p x --output:-- {:bla=>{:some_key=>true}} But I couldn't figure out how to do it, so I fudged the output. It was really: --output:-- Nuh uh, shorty. Don't bring that stepped on hash round here no mo'. -- Posted via http://www.ruby-forum.com/.