From: AD60 Date: 2009-03-01T09:38:57+09:00 Subject: Re: Newbie question > Hash workings Thank you both for seeing the light at the end of the tunnel. I fully understand what I have to do to get it working but just to clarify; By doing "h[2] << 20" I modified the original empty array I set as a default value and inserted no hash key because it is not an assignment to h? Replacing the "h = Hash.new([])" with "h = Hash.new { |h,k| h[k] = []}" and just doing "p h[2]" before any assigment to h[2] has the surprising/logical side effect of creating a new key "2", thank god with value "[]" so no problems there, but still... I am now thinking that stating "h = Hash.new([])" is problematic idiom under all circumstances. Am I correct? Kind regards, André