Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re^8: Error binmode() on unopened filehandle

by haukex (Archbishop)
on May 03, 2020 at 22:52 UTC ( [id://11116412]=note: print w/replies, xml ) Need Help??


in reply to Re^7: Error binmode() on unopened filehandle
in thread Error binmode() on unopened filehandle

This:
my $data = <<EOF; first second EOF
evidently deletes the <CR> characters.

Hmm, I'm quite surprised by that, and I'm still looking for the place where that's documented. Even trying to turn off the default :crlf layer on Windows doesn't seem to restore the CRLFs in $data. In addition, even on *NIX, eval "<<BAR\r\nx\r\ny\r\nBAR" causes the returned value to have only \n's, so it appears to be something to do with how heredocs are parsed. In fact, I've reported a bug.

Replies are listed 'Best First'.
Re^9: Error binmode() on unopened filehandle
by Marshall (Canon) on May 07, 2020 at 04:05 UTC
    I've been away for awhile and I am answering posts in LIFO order.
    At the end of the day, I do not recommend using a here-doc like shown to generate a binary byte sequence. There are other ways that "for sure" will work.

    Of course a binary file doesn't always have printable ASCII characters.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11116412]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (2)
As of 2024-04-19 19:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found