squares = [[1,1], [2,4], [3,9]]results = {}squares.each { |k,v| results[k] = v }p results # => {1=>1, 2=>4, 3=>9}p squares.inject({}) { |h, kv| h[kv[0]] = kv[1]; h } # => {1=>1, 2=>4, 3=>9}