develooper Front page | perl.perl5.porters | Postings from November 2003

Re: [perl #24519] Piped opening from command line?

Thread Previous | Thread Next
Nick Ing-Simmons
November 19, 2003 04:59
Re: [perl #24519] Piped opening from command line?
Message ID:
Leah <> writes:
># New Ticket Created by  Leah 
># Please include the string:  [perl #24519]
># in the subject line of all future correspondence about this issue. 
># <URL: >
>Is there a way to read files given on the commandline which begin or end
>with '|' (pipe) using <>, -p, or -n?  It doesn't seem to be possible. 

You can use the 3-arg form of open:

open(my $fh,'<',$ARGV[$N]);

or sysopen

use Fcntl;
sysopen(my $fh,$ARGV[N],O_RDONLY);

both avoid the magic.

>It seems strange that perl would trust the user to open arbitrary pipes.

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About