From: Peter Hickman Date: 2010-05-05T21:04:43+09:00 Subject: Re: troubles with nested hashes --0016363b9f2a5690f70485d7a118 Content-Type: text/plain; charset=ISO-8859-1 When you do this devices['macaddr'] = line[0] You are saying that the hash 'devices' has the key 'macaddr' and that contains the value that is held in 'line[0]'. Then you say devices['macaddr']['packets'] = line[1] This says that hash 'devices' has a key 'macaddr' which is a hash! For this to work, as written, the line[0] needs to be a hash. I suspect that it is not. What you probably want is this Csv.parse(whatever) do |line| macaddr = line[0] # Notice there are no quotes devices[macaddr] = { 'packets' => line[1], 'ip' => line[2], ... etc } end --0016363b9f2a5690f70485d7a118--