hobbies being the list of hobbies of one person
and persons_hobbies being...list of people who have hobbies???

James Gray wrote:
> On Dec 15, 2006, at 6:12 PM, Just Maz wrote:
> persons_hobbies = Hash.new
> hobbies         = Hash.new
> 
> DATA.each do |line|
>    fields = line.split
>    fields[3..-1].each do |hobby|
>      (persons_hobbies[fields[1]] ||= Array.new) << hobby
>      (hobbies[hobby] ||= Array.new) << fields[1]
>    end
> end
> 
> puts "=== Hobby Counts ==="
> puts hobbies.map { |h, c| "#{h}: #{c.size}" }

-- 
Posted via http://www.ruby-forum.com/.