As stated in the WIkipedia article (but not properly elaborated on): The reason that carriage return and linefeed are two different characters is mechanical constraints: On old Teletype (TTY) machines it takes about the time of two transmitted characters for the carriage to return to the starting position, but only one to advance the paper one line.

So the encoding allows for the additional time requirement by always requiring to send carriage return first, followed by a linefeed. This provides that characters can be send non-stop at maximum (45 Baud) speed in normal use (for example using a paper tape as source). While still giving the option of using CR and LF separately for specific purposes (CR alone for overwriting a line, LF alone as sort of vertical tabulator).

CuriousMarc has a nice demonstration of these early mechanical teletypes on his Youtube channel.

Cynic me suspects these work about the same speed as a modern Windows cmd.exe, which is why Windows still uses CR+LF ;-)

perl -e 'use Crypt::Digest::SHA256 qw[sha256_hex]; print substr(sha256_hex("the Answer To Life, The Universe And Everything"), 6, 2), "\n";'

In reply to Re^2: While i am executing a perl script in that one file will get as ouput in that ^M is priting and the actual output is getting disabled? by cavac
in thread While i am executing a perl script in that one file will get as ouput in that ^M is priting and the actual output is getting disabled? by himanshu.chauhan

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.