From: Matthew Moss Date: 2006-03-13T10:45:20+09:00 Subject: Array#inject with hash as initial, unexpected error (On Mac OS X 10.4.5, Ruby 1.8.4) Okay, so: > [1, 2, 3].inject(0) { |s, v| s += v } => 6 and: > [1, 2, 3].inject([]) { |a, v| a << v**2 } => [1, 4, 9] but: > [1, 2, 3].inject({}) { |h, v| h[v] = v**2 } => NoMethodError: undefined method `[]=' for 1:Fixnum What gives? I've tried replacing {} with Hash.new and a couple other variants without luck.