[prev in list] [next in list] [prev in thread] [next in thread] 

List:       perl-win32-users
Subject:    Re: Can't use $\ to force line termination to 0x0a
From:       wagnerc () plebeian ! com (Chris Wagner)
Date:       2005-02-24 16:10:21
Message-ID: 200502241610.j1OGAKZ07197 () mail ! goodnews ! net
[Download RAW message or body]

I've beaten myself up on similar line termination problems.  It's really
something that's poorly documented if u ask me.  I think part of ur
confusion comes from the fact that there's 3 layers involved that have
nothing to do with each other.  \n is the system local new line sequence,
which only happens to usually be a line feed, ^J.  $\ is only something that
is optionally tacked on to the end of a print command.  Nothing to do do
with \n.  So far so good.  Now there's the file handle STDOUT, which
translates ^M's and ^J's into whatever the system local newline convention
is, *for the benefit of the terminal*.  Because the terminal has it's own
expectations of what constitutes a new line, perl beats it's output into
whatever the local system expects.  If I'm being extra cautious I don't even
use \n, I'll call for \cM or \cJ directly.  So in summary, just do what Bill
said, use binmode. ;)


At 11:51 PM 2/23/05 -0700, neiljohn@xmission.com wrote:
>problem. PERL for Win32 writes the line terminators as CRLF (0x0d0a), and 
>the UNIX-based program blows up reading the "unexpected character" CR. What 
>we want to do is write LF (0x0a) as the text-file termination character. 
> Simple, no?





--
REMEMBER THE WORLD TRADE CENTER         ---=< WTC 911 >=--
"...ne cede males"

00000100

_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic