Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: pipe list open trouble?

by salva (Canon)
on Sep 30, 2014 at 13:13 UTC ( [id://1102429]=note: print w/replies, xml ) Need Help??


in reply to pipe list open trouble?

That's a quirk of the open built-in: It forces scalar context on its second argument.
open F, @ARGV;
... is equivalent to ...
open F, scalar(@ARGV);
As a workaround you can use...
my ($mode, @cmd) = @ARGV; open F, $mode, @cmd or die ...;

update: prototype shows it:

$ perl -E 'say prototype(\*CORE::open)' *;$@

Replies are listed 'Best First'.
Re^2: pipe list open trouble?
by LanX (Saint) on Sep 30, 2014 at 14:46 UTC
    Good example why the use of $ prototypes is usually discouraged. :)

    Cheers Rolf

    (addicted to the Perl Programming Language and ☆☆☆☆ :)

      Technically, prototypes are not involved here.

      The way open arguments are parsed is hard-coded inside the Perl grammar and the prototype(\*CORE::...) construction is just a facade.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (5)
As of 2024-04-23 20:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found