develooper Front page | perl.perl5.porters | Postings from May 2003

Re: Should PERLIO=no_crlf be the default on Cygwin?

Thread Previous | Thread Next
Gerrit P. Haase
May 31, 2003 05:08
Re: Should PERLIO=no_crlf be the default on Cygwin?
Message ID:
Hallo Abe,

Am Samstag, 31. Mai 2003 um 01:55 schriebst du:

> Op een zonnige lentedag (Friday 30 May 2003 17:19), schreef Gerrit P. Haase:

> ...

>> This will save me a lot of trouble responding to the questions why
>> Perl writes CRLF by default and that it breaks scripts.  I guess to
>> support the other five guys who want Perl to actually write CRLF's
>> will be easier;)
>> Comments?

> Yes please! 
> Although I think this should be related to the way one has installed cygwin 
> (DOSish or UNIXish textfiles)...

open(OUT, ">text.txt");
print OUT "This is a test.\n";
close OUT;

Should perl really write "This is a test.\r\n" only because I'm on a
textmount?  If you want to have perl to do this automatically, then
you may specify: open(OUT, ">:crlf", "text.txt"); which will write an
additional \r before the \n and there is no need to add this manually
in every line of output.

Also it is possible to define PERLIO=crlf in the environment to let
perl do this automagically.

I think, usually \r isn't needed at all and if you must have it, then
it is not impossible to get it.


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About