参考网上资源,得到两种实现方式:
#! /usr/bin/perl
use strict;
use warnings;
open A_SPEC, $ARGV[0] or die;
open DATA, $ARGV[1] or die;
my %list;
while (<A_SPEC>) {
chomp;
$list{$_}++;
}
my $select;
while (<DATA>) {
if (/^>(\S+)/) {
$select = exists $list{$1} ? 1 : 0;
}
print $_ if $select;
}
2. 前边读取列表方式一样,参考http://blog.sina.com.cn/s/blog_7d001f3d0101nw69.html
#! /usr/bin/perl
use strict;
use warnings;
open A_SPEC, $ARGV[0] or die;
open DATA, $ARGV[1] or die;
my %list;
while (<A_SPEC>) {
chomp;
$list