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.
Comment on Re^9: Error binmode() on unopened filehandle