in reply to Re^2: Binary conditionals
in thread Binary conditionals

Is that needed even though :raw is used? I think that the binmode documentation isn't entirely clear. It says:
If LAYER is omitted or specified as :raw the filehandle is made suitable for passing binary data.

That reads as if it made a call to binmode superfluous, but on the other hand it talks about a certain orthogonality between IO layers and binmode HANDLE.

Replies are listed 'Best First'.
Re^4: Binary conditionals
by bart (Canon) on Oct 01, 2008 at 12:55 UTC
    That reads as if it made a call to binmode superfluous

    You're wrong. Without binmode the file handle is in text mode. With binmode but without specified layer, or with layer "raw", it is in binary (raw) mode. That's not the same thing at all, at least, on platforms other than Unix.

    A call to binmode is not superfluous. Instead, I think forgetting about it is the reason why the OP got corrupted data:

    I know I'm fubar'ing the handling somehow; just don't know how :P

    p.s. to the OP: hex('0x17') is a silly, slow way to do things, if you can just enter a hexadecimal numeric literal: 0x17.