in reply to heredoc and Carriage return
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!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: heredoc and carriers return
by gabrielsousa (Sexton) on Oct 25, 2016 at 14:42 UTC | |
by LanX (Saint) on Oct 25, 2016 at 16:53 UTC | |
by gabrielsousa (Sexton) on Oct 25, 2016 at 20:08 UTC | |
by gabrielsousa (Sexton) on Oct 25, 2016 at 22:11 UTC | |
by pryrt (Abbot) on Oct 25, 2016 at 23:24 UTC | |
by LanX (Saint) on Oct 26, 2016 at 07:36 UTC | |
|