From: Lars Zeb Date: 2008-01-30T05:59:57+09:00 Subject: newbie file write problem This is my first attempt at ruby. I've written a class (SicCode) which parses a line and outputs a SQL command. I use the following to read an input file and to attempt to write: f = File.new("text.txt", "w") File.open("small.txt").each { |line| s = SicCode.new(line).get_sql f.puts "#{s}" } f.puts "This is a string" f.close The output file contains a blank line for each input line, plus the "This is a string" line. If I change the put to f.puts s, I get a nil for each input line. The get_sql method works fine interactively when I pass the class a string. What am I doing wrong? Frustrated