[Bioperl-l] difference in opening file from @ARGV and STDIN?

Dave Messina David.Messina at sbc.su.se
Thu Sep 11 17:15:44 EDT 2008

Cool, thanks for the explanation Malcolm!

At the risk of belaboring this point and your patience, one thing still
confuses me, though:

and if [@ARGV] is empty, $ARGV[0] is set to "-"

If $ARGV[0] is set (by Perl's ARGV processing magic) to '-', then why in
your earlier example do you manually set $ARGV[0] to '-' instead of simply
leaving @ARGV empty?

@ARGV = ('-') unless @ARGV;

If I run your example and omit '-' as an argument, it still works:

> echo -e ">asdf\natgc\n" | perl -MBio::SeqIO -e 'my $s =
Bio::SeqIO->new(-format => qw{fasta}, -fh => \*ARGV); print $ARGV[0] . qq{
has } . $s->next_seq()->seq . qq{\n}'
 has atgc


More information about the Bioperl-l mailing list