> heredoc read the LF ( \n ) , but dont parse / stores the carriers return ( \r )

there is a misconception on your side and probably it's an XY Problem too.

\n is the newline according to the OS you use and NOT (only) the LF from ASCII.

When you print "some line break \n and more lines" then Perl will autotranslate the \n to whatever *nix, win or mac wants to see.

Perl does it to assure maximum OS independency.

You are probably bitten by the reverse effect, that some combinations of CR and LF are interpreted as \n.

The answer to your problem is asking what for do you need it?

If you just need linebreaks ignore the effect, if you need the \r otherwise, do like suggested and include them explicitly.

You are free to put the text into an external file and read it in binmode , or even encode it as hex or base64 if you really need literally the same ascii code.

Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)
Je suis Charlie!


In reply to Re: heredoc and carriers return by LanX
in thread heredoc and Carriage return by gabrielsousa

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.