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

Re: [MacPerl] End-of-line separators (fwd)



According to Richard Rathe:
> On 3/14/97 Mark Manning/Metrica wrote:
> 
> >End-of-line separators:
> >
> >The Mac uses "\n".
> >The IBM uses "\r".
> >Unix uses "\n\r".
> 
> I thought it went like this...
> 
> Mac	CR	\015
> Unix	LF	\012
> DOS	CRLF	\015\012
> 
> I use this bit of code to change it as needed...
> 
>  $eol  = "\015\012";           # DOS
> #$eol  = "\015";               # Mac
> #$eol  = "\012";               # UNIX
> 
> Does anyone "know" the truth? <smile>

Mphfmbuldjrm! *POP*  Ah!  Now that I've taken my foot out
of my mouth!  ;-)

You are probably right about that!  :-)  Since (in C and
Perl both) when you are printing you usually just put "\n",
it gets a bit confusing which system uses what.  But I
believe that you are right.  And now that everything is
totally mixed up - let me try to correct myself.  (Although
my mom tried to correct me many years ago and that didn't
seem to work!  After all - I'm still a programmer!  ;-) )

The mac does use the carriage return (cr, \r).
The IBM does use the carriage return & line feed together (cr/lf, \n\r).
And Unix uses the line feed (also called a new line, lf, \n).

But in a program they all use \n.

:-)