While your history seems somewhat accurate you seem to be mistaken about what is meant by "\n" in Perl. First of all it is not necessarily a LINE FEED character. If the folks who wrote C and Perl had wanted to escape a character for LINE FEED then why did they not use "\l" that is an escaped ell or the lower case version of L. The reason is simple: "\n" is a logical newline, yes the n is for NEWLINE. NEWLINE is not a character in the ASCII character set. It is a contrivance to get around the platform incompatabilities that operating systems impose on what are colloquially known as "TEXT" files. It is true that Macs end their text file lines with a CARRIAGE RETURN character but within C, C++, Perl and several other Mac Programming languages you need only specify that you want a NEWLINE in your text file and:

print FOO "A\n";
will put the code 65 then the code 13 into your text file on a Mac, it would put the code 65 then 10 into the file on Unix and it would put the codes 65 13 10 into the file on a Microsoft operating system assuming that a binmode(FOO); statement had not appeared prior to the print statement.

By the way, Unix was invented around 1969-1970 and predates the only OSes that use the CARRIAGE RETURN + LINE FEED combination for end of text line characters by about 10-12 years. Unix uses a LINE FEED for the end of lines in files called text files. The Unix OS was capable of sending text files to printers for years before DOS came along.


In reply to Re: A Little History on 0D0A by Anonymous Monk
in thread Cross platform file I/O code by Beatnik

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.