From: Harrison Reiser Date: 2007-03-13T12:10:43+09:00 Subject: Re: non-destructive merging of hashes in array On Mar 12, 8:39 pm, "Mushfeq Khan" wrote: > You can even do: > > hashes.inject(Hash.new {|h, k| 0}) {|result, hash| result.merge(hash) {|k, > e, v| e + v}} Oh, you beat me to it. I might add, though, that the parameters in the initializer block can be safely removed: hashes.inject(Hash.new {0}) {|memo, hash| memo.merge(hash) {|k,e,v| e + v}} Harrison Reiser