From: Sebastian Hungerecker Date: 2007-12-13T23:54:23+09:00 Subject: Re: read in file Chris Daves wrote: > f = File.open(references, 'r') > file_data = f.read > f.close That can be written as file_data=File.read("references") It's generally better not to use File in a way that you have to manually close the file. > but i want to take this file data and interpret each line of data and > the put each line into a new file line by line. File.open(outfile, "w") do |of| File.foreach(infile) do |line| do_something_with line of.puts line end end HTH, Sebastian -- NP: In Flames - Everdying Jabber: sepp2k@jabber.org ICQ: 205544826