in reply to Re^2: binmode and one-liners
in thread binmode and one-liners

update: scratch that, I misread your post.

Well no, BEGIN blocks are executed first?

qwurx [shmem] ~ > echo foo > foo; echo bar >> foo; qwurx [shmem] ~ > perl -ple 'BEGIN { close ARGV } print' foo foo bar

Had the filehandle ARGV ever been open before or in the BEGIN block, it is re-opened after the BEGIN block. But I would guess ARGV isn't open in the BEGIN block. Makes more sense to me, anyways. But... perhaps

perl -ple 'BEGIN{close ARGV; binmode ARGV} s/foo/bar'

will do.

--shmem

_($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                              /\_¯/(q    /
----------------------------  \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}