my @fasta_objs =(); ... push @fasta_objs,$seqFile1->seq; ... $fasta->write_seq($seqFile2) if (grep {$_ eq $seqFile2->seq} @fasta_objs);