[Bioperl-l] What happens to STDOUT?
Roy Chaudhuri
roy at colibase.bham.ac.uk
Fri Mar 31 13:59:18 UTC 2006
> A little off topic, but might be usefull as well.
> Sometimes you don't know whether the input sequences will come from
> stdin or from a file. Therefor, I ofen found myself writing things like:
> my $seqin = Bio::SeqIO->new(-format => $informat, $file ? (-file =>
> $file) : (-fh => \*STDIN));
> This can be replaced by:
> my $seqin = Bio::SeqIO->new(-format => $informat, $file ? -fh =>
> \*ARGV);
I suspect you mean:
my $seqin = Bio::SeqIO->new(-format => $informat, -fh => \*ARGV);
But does this work? perldoc perlvar says it "may not":
Note that currently ARGV only has its magical effect within the <>
operator; elsewhere it is just a plain filehandle corresponding to the
last file opened by <>. In particular, passing \*ARGV as a parameter to
a function that expects a filehandle may not cause your function to
automatically read the contents of all the files in @ARGV.
> In that way, you have the same magic as the diamond/pulp fiction
> operator <>
Pulp fiction operator? Never heard it called that before.
Roy.
--
Dr. Roy Chaudhuri
Bioinformatics Research Fellow
Division of Immunity and Infection
University of Birmingham, U.K.
http://xbase.bham.ac.uk
More information about the Bioperl-l
mailing list