From: Todd Benson Date: 2008-05-28T04:48:19+09:00 Subject: Re: n00b question On Tue, May 27, 2008 at 1:36 PM, Todd Benson wrote: ...some code that didn't paste correctly (the spaces). This is what it is supposed be... post.txt: a 1 b - 2 a - 4 b 8 RPT1 2 RPT g - 1 prev.txt: a 2 b - 2 a 0 b 7 z 9 RPT1 2 run_report.rb: post = Hash.new(0) IO.foreach("post.txt") do |line| post[line[3..3]] += line[5..7].to_i.to_f unless line[0..2] == "RPT" end prev = Hash.new(0) IO.foreach("prev.txt") do |line| prev[line[3..3]] += line[5..7].to_i.to_f unless line[0..2] == "RPT" end report = {} (post.keys | prev.keys).each do |k| report[k] = post[k], prev[k], post[k] - prev[k] end p report ...and no empty lines in your data files, or you'll have to ignore them, too, in your program. I figured out what happened. I copied, then pasted back to my editor, then copied back again. Sorry, Todd