Thomas Sawyer wrote: > Ruby 1.8.7 p72 > > >> "A\nB\nC".lines.to_a > => ["A\n", "B\n", "C"] > > Please, tell me that's a mishap, and not how 1.9 works. I'd expect: > > >> "A\nB\nC".lines.to_a > => ["A", "B", "C"] Why would you expect that? The documentation is very clear. --------------------------------------------------------------- IO#lines ios.lines(sep=$/) => anEnumerator ios.lines(limit) => anEnumerator ios.lines(sep, limit) => anEnumerator ------------------------------------------------------------------------ Returns an enumerator that gives each line in _ios_. The stream must be opened for reading or an +IOError+ will be raised. f = File.new("testfile") f.lines.to_a #=> ["foo\n", "bar\n"] f.rewind f.lines.sort #=> ["bar\n", "foo\n"] If it changed in 1.9, that would be another source of incompatibilities. Perhaps most importantly of all, if the newlines were stripped, there would be loss of data and it would be impossible to reconstruct the original file exactly from the members of the lines array (e.g. lines.join), as your example shows nicely. -- Posted via http://www.ruby-forum.com/.