From: Logan Capaldo Date: 2006-05-23T05:37:55+09:00 Subject: Re: Creating Hash of Arrays On May 22, 2006, at 4:28 PM, Paul D. Kraus wrote: > How can I create a hash that contains an array for its value? How > can I then > loop through the hash keys and intern the contained arrays. > > Pseudo Code > ------------------ > myhash['customercode'][0]=Firstname > myhash['customercode'][1]=M.I > myhash['customercode'][2]=Lastname > > myhash.each do |k,v| > myhash['k'].each do |elm| > puts "#{k} -> elm" > end > end hsh = Hash.new { |this_hash, key_that_didnt_exist| this_hash [key_that_didnt_exist] = [] }