in reply to Re: binmode(STDIN)
in thread binmode(STDIN)

If that is a normal DOS text file and your trick worked, then the output should include "0d0a" not just "0a".

Perhaps you should double check that the binmode took effect and post your evidence.

You pretty much have to get the perl excutable to do the binmode for you since <> doesn't open the file until it also reads the first line from the file, so Perl scripting code has no way to insert a call to binmode between the implicit open and the reading.

This is a perfect use for open.pm, except it doesn't work with <> (unless that has been fixed recently).

- tye        

Replies are listed 'Best First'.
Re^3: binmode(STDIN) (testing)
by BrowserUk (Patriarch) on Feb 09, 2005 at 03:07 UTC

    Hmmm, This was the original test I did:

    [19:50:37.28] P:\test>perl -ple"INIT{binmode(*ARGV,':raw');$/=\64}" -e +"$_=join $\,join' ',unpack'(A8)*',unpack'H*',$_" 2.log 313a2063 6f6d3a31 3a203e20 6c6f6766 696c653a 322e6c6f 670a0d0a 313a206 +3 6f6d3a31 3a203e20 6c6f6766 696c653a 322e6c6f 670a0d0a 313a2063 6f6d +3a31 3a203e20 6c6f6766 696c653a 322e6c6f 670a0d0a 313a2063 6f6d3a31 3a203e2 +0 6c6f6766 696c653a 322e6c6f 670a0d0a 313a2063 6f6d3a31 3a203e20 6c6f +6766 696c653a 322e6c6f 670a0d0a 313a2063 6f6d3a31 3a203e20 6c6f6766 696c653 +a 322e6c6f 670a0d0a 313a2063 6f6d3a31 3a203e20 6c6f6766 696c653a 322e +6c6f 670a0d0a [ 3:00:14.96] P:\test>

    Which certainly does have (several) of the 0d0a sequences.

    But looking more closely, it's actually '0a0d0a' which my eye's did not discern, I should have used a larger font.

    I admit it. I saw what I wanted to see, and then faffed around with getting the formatting right.

    Sorry.


    Examine what is said, not who speaks.
    Silence betokens consent.
    Love the truth but pardon error.