Setting end-of-line character for puts
- by Dom De Felice
I have an array of entries I would like to print.
Being arr the array, I used just to write:
puts arr
Then I needed to use the DOS format end-of-line: \r\n, so I wrote:
arr.each { |e| print "#{e}\r\n" }
This works correctly, but I would like to know if there is a way to specify what end-of-line format to use so that I could write something like:
$eol = "\r\n"
puts arr
UPDATE
I know that puts will use the correct line-endings depending on the platform it is run on, but I need this because I will write the output to a file.