perl - newlines when displayed in Windows -
open out, ">output.txt"; print out "hello\nworld";
when run above perl code in unix system , transfer output.txt
windows , open in notepad shows as:
helloworld
what need newlines displaying in windows?
text file line endings platform-specific. if you're creating file intended windows platform should use
open out, '>:crlf', 'output.txt' or die $!;
then can just
print out "hello\nworld!\n";
as normal
the :crlf
perlio layer default perl executables built windows, don't need add code create files intended platform. portable software can check host system examining built-in variable $^o
Comments
Post a Comment