On 3/13/07, Mushfeq Khan <mushfeq.khan / gmail.com> wrote:
> How's this:
>
> hashes.inject({}) {|result, hash| result.merge(hash) {|k, e, v| (result[k]
> || 0) + v}}
>
> or similarly:
>
> hashes.inject(Hash.new {|h, k| 0}) {|result, hash| result.merge(hash) {|k,
> e, v| result[k] + v}}

I bow to superior technique, the merge block form is particularly nice.

>
> Mushfeq.
>
Robert
-- 
We have not succeeded in answering all of our questions.
In fact, in some ways, we are more confused than ever.
But we feel we are confused on a higher level and about more important things.
-Anonymous