From: EdUarDo Date: 2005-09-17T00:11:35+09:00 Subject: Hash table questions Hi all, I'm filling up a hash table reading data from a file. 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 The content oh the hash table is: coords.each do |key, value| puts key, value end DC CENTER2,8,6,10RIGHT0,8,3,10LEFT5,8,8,10 MP CENTER3,5,7,8RIGHT5,5,8,8LEFT0,5,3,8 M CENTER2,3,6,7RIGHT5,3,8,7LEFT0,3,3,7 DF CENTER2,0,6,4RIGHT6,0,8,4LEFT0,0,2,4 CD CENTER2,2,6,5RIGHT1,2,5,5LEFT3,2,7,5 So I suppose hash table has a 'DC' key, but these sentences return 'false' @position.post = :DC puts coords.has_key?(@position.post.to_s) puts coords.has_key?(@position.post) puts coords.has_key?('DC') Why I can't access 'DC' key with @position.post?