Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re^3: binmode and one-liners

by shmem (Chancellor)
on Jun 30, 2007 at 09:36 UTC ( [id://624184]=note: print w/replies, xml ) Need Help??


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}

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://624184]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (2)
As of 2024-04-26 03:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found