On Fri Apr 15 12:06:47 2011, patrickas wrote: > On windows 7 and vista using "\n" does not produce \r\n > > The following > > my $file = open('foo.txt', :w); > $file.say("a\nb"); > $file.close; > > produces a file containing the bytes > > 61 0a 62 0a > > The expected bytes are > > 61 0d 0a 62 0d 0a > > A current work around is to use > > $file.print("a\r\nb\r\n");
Now \n in strings is "magical": it will default to CRLF on Windows, and just LF elsewhere (you can see what $?NL contains to check). It can be controlled by the newline pragma when this default is not appropriate, tests for which are in S16-io/newline.t. Thanks, Jonathan