From: Brian Candler Date: 2010-02-02T04:15:58+09:00 Subject: Re: Adding keys to a hash in a loop Jack Bauer wrote: > Hi all, > > I'm trying to essentially accomplish this behavior: > > output.each do |item| > output_hash << {item.name => []} > end Apart from the other suggestions, you can do: output.each do |item| output_hash.merge!(item.name => []) end -- Posted via http://www.ruby-forum.com/.