[Israel.pm] newline character as a portability issue

Dovalle Yankelovich dovalle at smlink.com
Wed Jul 7 23:44:49 PDT 2004


Another solution, which will work only if you first read a file with
return new line on a machine and manipulate it to work on same machine,
is 
$file =~ s(\015\012?|\012){\n}g;


Regards,
Dovalle


-----Original Message-----
From: Shlomo Yona [mailto:shlomo at cs.haifa.ac.il] 
Sent: Thursday, July 08, 2004 06:50
To: Perl in Israel
Subject: RE: [Israel.pm] newline character as a portability issue

On Thu, 8 Jul 2004, Dovalle Yankelovich wrote:

> I think the ASCII codes 13, 10 (carriage return and new line
> respectively) should be 'cross platform', so instead using shorts
(such
> as '\n') add these 2 chars to your output.

This probably isn't exactly accurate.
perldoc perlport also mentions \015 and \012...

So -- apparently, this is indeed something which requires
some general handling rather than simply betting on the
correct character...


-- 
Shlomo Yona
shlomo at cs.haifa.ac.il
http://cs.haifa.ac.il/~shlomo/
_______________________________________________
Perl mailing list
Perl at perl.org.il
http://perl.org.il/mailman/listinfo/perl




More information about the Perl mailing list