At 15:33 -0500 02.05.2001, Fernando Trias wrote:
>You get 7. As far as I know, the "\n" -> "\r\n" conversion only occurs when
>you write to a file. The string in Perl is the same and stays the same.

This is true.  Same thing on reading a file on Windows ... unless you call
binmode().  Then you get the raw, two-byte, CRLF.

My rule of thumb is this: when dealing with a native filesystem, use \n.
When dealing with network protocols, or a specific filesystem that may have
different newlines than your native newline, use the specific octal values.
So if writing to a file, I would just use "\n".  But writing to a file on a
Windows volume mounted on my Linux box, I might use "\015\012".  When
writing out HTTP headers, I would use "\015\012".  etc.

Use your own rules and thumbs, but this one seems to work well for me ...

-- 
Chris Nandor                      [EMAIL PROTECTED]    http://pudge.net/
Open Source Development Network    [EMAIL PROTECTED]     http://osdn.com/

Reply via email to