On 10-10-13 04:16 PM, Amish Rughoonundon wrote:
Hi,
  I would like to print a file under windows using perl but with the
end of line character be only 0x0A and not 0x0D followed by 0x0A. Is
there a way to set $\ to 0x0A so that every time I use print, it only
prints 0x0A and NOT 0x0D followed by 0x0A. Any other method would also
be welcomed. Thanks for the help,
Amish



On Windows, Perl automatically change CR-LF on input to LF and LF to CR-LF on output. To force it, change its layer to ':crlf'

open my $fh, '>:crlf', $file or die $!;

Others layers are:
:raw  which does not convert anything
:encoding(utf8)  which converts to/from UTF-8 encoding


See:
perldoc opentut
perdloc -f binmode
perldoc -f open


--
Just my 0.00000002 million dollars worth,
  Shawn

Programming is as much about organization and communication
as it is about coding.

The secret to great software:  Fail early & often.

Eliminate software piracy:  use only FLOSS.

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to