> So you can see that the string is 4 bytes long. When I write it to the file,
> the file becomes 5 bytes, because the LF is converted to a CR/LF pair. When
> I read it back in, the reverse conversion is made, so the string becomes 4
> bytes again. When I call binmode, that conversion is not
I got the same results using ActiveState on NT 4.0 but
cyqwin gives me:
length is 4
-rw-r--r--1 dennis None5 Jan 31 10:02 foo.txt
length is 5
length is 5
I will leave the analysis to someone more qualified than I!
Good Luck!
Dennis
--
To unsu
> -Original Message-
> From: Bob Showalter [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, January 31, 2002 9:02 AM
> To: 'Dave Benware'; Beginners perl
> Subject: RE: What is the newline character (\n) equal to?
>
>
> > -Original Message-
> -Original Message-
> From: Dave Benware [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, January 31, 2002 8:51 AM
> To: Beginners perl
> Subject: Re: What is the newline character (\n) equal to?
>
>
> Dave Benware wrote:
> > CR/LF has never been translate
ISSUES
Newlines
In most operating systems, lines in files are terminated
by newlines. Just what is used as a newline may vary from
OS to OS. Unix traditionally uses `\012', one type of
DOSish I/O uses `\015\012', and Mac OS uses `\015'.
Perl uses `\n' to represent the "logical" newline, where
Dave Benware wrote:
> CR/LF has never been translated to a LF while reading a file
> for me. If that were true, the whole situation would be
> transparent and I would have never asked the question it seems.
> I didn't see anything about this "translating" in the docs
> on the binmode function.
>
Bob Showalter wrote:
> No. A "\n" in your program is an ASCII linefeed (10) character
> on either platform.
So, \n equals a LF, thank you.
>
> What happens on Windows is that when you are reading a file,
> each CR/LF pair from the file is changed to a single LF char
> before the data is return
> -Original Message-
> From: Dave Benware [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, January 30, 2002 8:50 AM
> To: [EMAIL PROTECTED]
> Subject: What is the newline character (\n) equal to?
>
>
> Correct me if I'm wrong, the newline character \n is
> p
,
\n is actually platform INdependant.
Joe
-Original Message-
From: Dave Benware [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 30, 2002 7:50 AM
To: [EMAIL PROTECTED]
Subject: What is the newline character (\n) equal to?
Correct me if I'm wrong, the newline character \n is
pla
: Wednesday, January 30, 2002 8:50 AM
To: [EMAIL PROTECTED]
Subject: What is the newline character (\n) equal to?
Correct me if I'm wrong, the newline character \n is
platform dependent. On unix-type it would equal a LF
and on Windows it would equal a CRLF.
Right?
Bompa
--
To un
Correct me if I'm wrong, the newline character \n is
platform dependent. On unix-type it would equal a LF
and on Windows it would equal a CRLF.
Right?
Bompa
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
11 matches
Mail list logo