From: Robert Klemme Date: 2006-03-19T21:33:50+09:00 Subject: Re: Hash of Arrays nItems problem hoyhoy@gmail.com wrote: > I'm having a bit of problem using a hash of arrays. It appears that > nitems are wrong for the individual elements are wrong when I do this: > > #!/usr/bin/env ruby > $:.unshift(File.join('..', 'lib')) > require 'http-access2' > > h = HTTPAccess2::Client.new() > element = Hash.new([]) You want element = Hash.new {|h,k| h[k] = []} Otherwise you'll be adding to the *same* single array instance for *all* elements. Kind regards robert