用 perl 统计 fasta 文件序列的总长
#!/usr/bin/perl -w
use strict;
die "Usage: $0 <file>\n" unless (@ARGV == 1);
my $lines = 0;
my $bases = 0;
while (my $line = <>){ # <> operator reads one line at a time from the file specified by $ARGV[0].
chomp $line;
next if $line =~ /^>/;
$lines++;
$bases += length($line);
}
print "$bases\n";