So I have a file in the form of:
Key1 Value1
Key2 Value2
Key3 Value3
seperated by a tab. My question is how do I open this file and put it into a hash? I have tried to do:
fp = File.open(file_path)
fp.each do |line|
value = line.chomp.split("\t")
hash = Hash[*value.flatten]
end
But at the end of this loop the @datafile hash only contains the latest entry...I kinda want it all.....