On Wed, Aug 17, 2011 at 6:53 PM, Bryan R Harris <bryan_r_har...@raytheon.com> wrote: > How can I use the "safe" 3-argument open and still be able to read off a > pipe?
What I have done in the past is manually compare the filename to '-' and skip the opening and just assign STDIN to my file handle. use strict; use warnings; my @filenames = qw(-); @filenames = @ARGV if @ARGV; for my $filename (@filenames) { my $fh; if($filename eq '-') { $fh = \*STDIN; } else { open $fh, '<', $filename or die "Failed to open '$filename': $!"; } # Etc... } __END__ Perhaps experienced Perl programmers know of better ways, in which case I would be happy to learn them also. :) -- Brandon McCaig <http://www.bamccaig.com/> <bamcc...@gmail.com> V zrna gur orfg jvgu jung V fnl. Vg qbrfa'g nyjnlf fbhaq gung jnl. Castopulence Software <http://www.castopulence.org/> <bamcc...@castopulence.org> -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/