From: Sam Duncan Date: 2012-05-01T05:13:07+09:00 Subject: Re: Writing a file to txt, how can I put a new line? On 01/05/12 07:59, Christopher D. wrote: > pat eyler wrote in post #1058996: >> You might want to look at puts. Or maybe one of the logging libraries >> that >> solve logging for you (more or less) > Hi pat, thanks for getting back to me > > The logger isn't exactly what I'm looking for here... just a simple way > to list a few things in my array in a text file line by line instead of > consecutively.. > > I also tried > txt<< puts line > txt<< "#{puts ""}" > txt<< "#{puts line}" > Have you tried simply writing the whole array joined by carriage returns to the file? File.open(my_log_file, "w") { |f| f.write(my_log_array.join("\n")) } Sam