From: James Edward Gray II Date: 2005-09-17T00:40:02+09:00 Subject: Re: Hash table questions On Sep 16, 2005, at 10:31 AM, EdUarDo wrote: >> coords = {} >> File.open('/home/eyp/socceralive/lib/model/zones.dat') do |file| >> while !file.eof? do >> pos = file.readline >> line = file.readline >> data = line.split(';') >> coords.store(pos, {:CENTER=>data[0], :RIGHT=>data >> [1], :LEFT=>data[2]}) >> end >> end >> > > More questions about this code. I'm filling up the hash with > another hash tables. > > If I access coords['DC'] I get another hash, but coords['DC'] > ['CENTER'] retrieves me a nil value. > How must I access data from hash tables inside first hash table? You used symbols for keys to the second hash: coords["DC"][:CENTER] Strings are not the same as symbols, or vice versa. James Edward Gray II