From: David Springer Date: 2010-03-06T04:56:29+09:00 Subject: Re: Different behavior of '$,' output separator in Ruby 1.9 Alex, If you make a few minor modifications: ------------------------------------------- $, = ', ' $\ = "\n" ### output record separator ### data = [['a', 'b', 'c'], ['1', '2', '3'], ['x', 'y', 'z']] file_out = File.new("test.csv", "w") data.each do |elem| file_out.print elem[0], elem[1], elem[2] ### no newline FIELD ### end file_out.close ------------------------------------------- then you will get what you want in Ruby 1.9. a, b, c, 1, 2, 3, x, y, z, I have not tried it in Ruby 1.8. Looks like it is adding the output field separator AFTER the newline FIELD. -- Posted via http://www.ruby-forum.com/.