my %fasta_objs =(); ... ++$fasta_objs{$seqFile1->seq}; ... $fasta->write_seq($seqFile2) if exists $fasta_objs{$seqFile2->seq};