--0-993351607-12312700771916 Content-Type: text/plain; charset=us-ascii Thanks for the tips. I learned a lot from all of the suggestions. Not sure, though, if I understand this line: hash[1][2][3] ash.new(0) Is that a valid line on its own. If so, it does not seem to work for me. I get the following error: undefined method `[] for 0 Glenn ________________________________ From: David A. Black <dblack / rubypal.com> To: ruby-talk ML <ruby-talk / ruby-lang.org> Sent: Monday, January 5, 2009 7:12:59 AM Subject: Re: Default values of hashes Hi -- On Mon, 5 Jan 2009, Sebastian Hungerecker wrote: > David A. Black wrote: >> Why not make it just keep going automatically? (See my other post.) > > Because a) that way you can't define a default value or proc for the innermost > hash, b) you won't get an error if you accidentally go one nesting too deep, > c) because that's what the op asked for and most importantly d) because you > already gave the answer with unlimited nesting ;-) I'm with you on a) and d) :-) I didn't understand the OP to be asking for that constraint. As for a), you could just do the old-fashioned: hash[1][2][3] ash.new(0) and at least reap the benefits of getting the intermediate ones. David -- David A. Black / Ruby Power and Light, LLC Ruby/Rails consulting & training: http://www.rubypal.com Coming in 2009: The Well-Grounded Rubyist (http://manning.com/black2) http://www.wishsight.com Independent, social wishlist management! --0-993351607-12312700771916--