From: Farhad Farzaneh Date: 2007-07-04T18:22:26+09:00 Subject: Re: Isn't hash default value behavior just a little bizarre? Alex Young wrote: > Apologies if you've already come across this, but I think the correct > way to do what you're trying to do is this: > > h = Hash.new(){|h,k| h[k] = []} > > The block passed to Hash.new gets called for each new entry in the hash, > so a new array will be constructed each time. > > Hope this helps, Sweet. Now that looks very Ruby'ish! Thanks. -- Posted via http://www.ruby-forum.com/.