use Bio::SeqIO; my $input = new Bio::SeqIO(-format => 'fasta', -file => 'inputfile'); my $output = new Bio::SeqIO(-format => 'fasta', -file => '>outputfile'); while( my $seq = $input->next_seq ) { # skip the whole entry if the sequence constains the # pattern using Abigail-II's suggestion next if ( $seq->seq() =~ /\.(?:WKP|MRP)/); # otherwise write the sequence out to the output file $out->write_seq($seq); }