File.open.each() while using a 2 level hash

I am doing:
SourceHash = {}
File.open("file_to_open").each {|line|
  SourceHash[var[3]] = {}
  puts SourceHash['VALUE']['cktid']
}

var is just an array of each csv value.

The error says undefined method [] for nil:NilClass in 'each'

If I take the hash statement out of the file loop it works. Any ideas
why the "each" method is throwing an error while trying to get a value
out of a 2 level hash??

Unless var[3] == 'VALUE' then SourceHash['VALUE'] is going to return a
nil, and your puts expression amounts to nil['cktid'], which would
produce the error you describe.

Also--in ruby, variables that begin w/capital letters are constants--you
should rename to source_hash or something in order to decrease your risk
of confusing the interpreter.

HTH,

-Roy