On Nov 8, 2011, at 13:48 , Cassna Capriet wrote: > You have to declare your variable in this way: > > a = Hash.new{|h, k| h[k] = Hash.new(&h.default_proc)} I prefer a more readable approach: class NestedHash < Hash def initialize super { |h,k| h[k] = NestedHash.new } end end a = NestedHash.new