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

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

Thread Previous | Thread Next
From:
Nick Ing-Simmons
Date:
November 19, 2003 04:59
Subject:
Re: [perl #24519] Piped opening from command line?
Message ID:
20031119124811.2752.16@llama.elixent.com
Leah <perl5-porters@perl.org> writes:
># New Ticket Created by  Leah 
># Please include the string:  [perl #24519]
># in the subject line of all future correspondence about this issue. 
># <URL: http://rt.perl.org/rt2/Ticket/Display.html?id=24519 >
>
>
>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


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About