From: Jack Bauer Date: 2010-02-02T02:50:46+09:00 Subject: Re: Adding keys to a hash in a loop Robert Klemme wrote: > Erm, how would you put a key value pair into a Hash without a loop? This is the loop... output.each do |item| output_hash << {item.name => []} end Iterate through items in the "output" array and create a key for the "output_hash" hash using the value of "item.name" as the key, and an empty array as the value for that key. I know the output_hash << won't work, that's why I'm asking how I can go about it. I was just using that as a sort of pseudo-code to get my point across. -- Posted via http://www.ruby-forum.com/.