use strict; use warnings; #counting motifs use Bio::SeqIO; my $file = "SeqHisham.txt"; my $in = Bio::SeqIO->new( -format =>'fasta', -file =>$file, ); my $motif_Count=0; my $motif = 'ga'; while(my $seq = $in->next_seq){ #since the sequence would be processed in a certain way convert to string my $string = $seq->seq; if($string=~/$motif/i){ #make the regex appropriate... $motif_Count++; } } print "Found $motif_Count hits\n";