lassehp@imv.aau.dk schinder@pjstoaster.pg.md.us mac-perl@iis.ee.ethz.ch Subj: Re: [MacPerl] Recognizing Unix Line Breaks Lasse writes a message received 7-MAY-1997 07:02:17.44 !Paul J. Schinder wrote: ! !>To most of "everyone else", \n means \015\012 (Microsoft is a monument to !>human stupidity in more ways than one). ! !I agree with the rest of that paragraph, which is why I deleted it. !However, I'm sure CRLF precedes MicroSnot DOS by a decade or so. It !certainly was used in CP/M, and judging by it's existence in various RFC, !dating back before anyone had dreamed of putting DOS machines on the !Internet, I would think other old OSes (VMS?) use it as well. In a wicked !way CRLF even makes sense on slow machines with slow output devices and !moderate storage. Just as \n makes sense on relatively fast machines with !slow output devices and moderate storage (Here, processing of \n into CRLF !is not a problem.) Today, it shouldn't really matter which one to use, so !we _should_ probably apply the Postel principle of liberal handling of !input and conservative generation of output. I love that principle. !Alas, there is no easy way to have Perl recognize all three of CRLF, CR and !LF as input line-breaks, is there? I think that the CRLF end of line habit was due to old teletype terminals that needed a couple of characters in their input stream to allow enough time for the teletype head to due just that: return to the left most position and advance the paper. IBM mainframe OSes used it and it was adopted by MS for the IBM-PC Disk Operating System. The "old" OS that you mentioned (VMS) is not all that old: VMS was released/shipped in 1978/79 - 10 years after the invention of UNIX and about the same time that IBM had let their contract out to Bill Gates and company to make PC-DOS->MS-DOS and one to two years after Steve Jobs et al. started selling Apples. On VMS in C and in perl "\n" -> LF (decimal ascii 10), (though if done as part of a DCL job it may be a CRLF sequence depending on the vintage of your C runtime library). Amidst all this talk of C<use "\015\012" rather than "\r\n"> I can't help but mention that this is an ASCIIism: on IBM MVS servers do not try \015\012 as those EBCDIC characters are not CRLF. If you do write cgi scripts in perl for IBM mainframes ;-) then try this: print "Content-type: text/html\r\n\r\n"; # OK for EBCDIC rather than: print "Content-type: text/html\015\012\015\012"; # ASCII BTW on Macs, most unices, and VMS LK201 keyboards; the key that you press to get an end of line is labelled "Return" and on most PCs it is labelled "Enter". Hence, the Mac has the most consistent and logical keyboard->filestream setup (IMO). Despite that logic the mnemonic value of "\n" -> newline and "\r" -> return is nice. Have fun. Peter Prymmer ***** Want to unsubscribe from this list? ***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch