Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
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":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (1)
As of 2024-04-25 00:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found