On Mon, 28 Aug 2000, Dave Thomas wrote: > It would help with both the Hash stuff above, and also with things > like > > str.scan(/\w+/) { |w| freq[w] += 1 } > > > Matz: what obvious major flaw am I missing here? I'm not Matz, but I know the easy solution, thanks to my friend Akinori MUSHA :) Snipping parts of http://people.FreeBSD.org/~green/ann2loc.rb: committers = Hash.new(0) $stdin.each_line {|line| next unless line =~ /^[^(]*\(([^[:space:]]*)/p committers[$1] += 1 } Hash.new may take an argument that specifies the default value for hash members. To do it with empty arrays, for example: {"/home/green"}$ ruby -e 'p Hash.new(Array.new)["nil"].type' Array Hope it helps! > Dave -- Brian Fundakowski Feldman \ FreeBSD: The Power to Serve! / green / FreeBSD.org `------------------------------'