No! If you are printing text, at least x'0A' (line feed) will be inserted (not x'0D').

The question is whether or not a x'0D' (carriage return) will also be inserted before the x'0A'. If you are interested , I refer you to: http://www.asciitable.com/ for the standard ASCII characters (doesn't cover the wide 16 bit ones).

In ancient days, each line ended with CR,LF,RUBOUT(x'00'). The RUBOUT(NUL) x'00', was needed to keep the fingers on the mechanical tape reader/punch lubricated. Keeping the CR and LF separate allowed pictures to be drawn of a sort. CR (carriage return) just meant go back to the beginning of the line and then more stuff (different characters) could be printed on the same line. I hope you get to see one of these early pictorial masterpieces. I haven't used a printer for a very long time that could reproduce such an image - there isn't any idea that "over-striking" something will make it darker like existed with typewriter ribbon technology.

As far as Perl goes, Perl print in a text context will do the "right thing" for your platform. For some reason Windows kept this CR,LF idea while Unix moved to just LF.

I have often moved files between Unix and Windows systems. In the old days, this was a big hassle and I would have to run some sort of "fixit" script on one machine or the other. Now I just use FireFTP (other modern FTP programs work also) and this automatically adjusts this stuff for me when I am in text mode (and it is very smart about figuring that out).

Perl itself is "smart" about CR/LF. It will ignore this CR if it exists. Perl can read any text file that it created on any platform.

There are some situations, like hashing to disk with fixed record sizes where this line termination stuff matters a lot. But I'm not hearing that is not the case. I've written programs in both Perl and C using this concept and I'd be happy to show you the code, but I don't think that is what you need.

In short: don't worry about this in your Perl programs. If this CR needs to be inserted before the LF, use a std FTP program in text mode to make the transfer between the *NIX and Windows box.


In reply to Re: How to insert Hexadecimal characters by Marshall
in thread How to insert Hexadecimal characters by paragkalra

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.