[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] parsing text from a file




On Mon, 26 Apr 1999, Chris Nandor wrote:

> \r and \n don't have consistent meanings across platforms.  On Mac, CRLF is
> \n\r, and on Unix and DOS, it is \r\n.  Also, the above regex would (for a
> DOS file on a Mac) convert all CRLFs to CRCRs, which likely isn't what you
> want.  :)  Safer to use the explicit octals (\015\012) or hex chars
> (\xD\xA).

Isn't this essentially just a MacPerl behavior?  For years, few
distinguished between octal codes for \n and \r, on any platform including
Macs, until a certain innocent design decision to remap these in MacPerl.

And "CRLF" is mostly a DOS thing...the real question _used_ to be what did
your platform use as EOL (end-of-line) marker:  lf (Unix), cR (Mac), or
CRLF (DOS).  

I guess it all started with the C programming language and "\n" as the
universal force-a-new-line.  linefeed/lf/\n became EOL in a bazillion
programs, so the platforms started having adjust to the code, rather than
vice versa.  Perl could have done better, but really it has even deeper
ties to the Unix tradition, so I can't blame it.

--
MattLangford 


===== Want to unsubscribe from this list?
===== Send mail with body "unsubscribe" to macperl-request@macperl.org