in reply to binmode(STDIN)

I have a script that reads STDIN by setting $/ to \16 and uses while (<>)
while (<>) does not read from STDIN, it reads from the special magic file handle ARGV. If if there are no arguments passed into @ARGV then ARGV is STDIN.

I seem to recall reading somewhere that the only way to get the ARGV magic to open the files listing in @ARGV binary mode is to use open and that this is only available in 5.8 onwards.

Replies are listed 'Best First'.
Re^2: binmode(STDIN)
by PhilHibbs (Hermit) on Feb 08, 2005 at 18:15 UTC
    What does use open mean in this context? Should I just put a line that says "use open;" in my code? I've never heard of the open module.

    PhilHibbs runs 'perldoc open' and reads it

    Update: I tried putting use open ':bytes'; in, but that fails:
    Unknown PerlIO layer class ':bytes' at C:\bin\hexdump.cmd line 10

    Update: I tried putting use open ':utf8'; in, but that makes no difference, it still only outputs 0A for a line-end if the file name is a parameter, but 0D 0A if it's piped or redirected in.

    Update: It's just clicked - this is what tye is talking about in his reply above.