$infile="input.txt"; open(IN, "$infile") or die "can'topen \"$infile\""; $genom=""; while($line=) { chomp $line; $genom.=$line; } @allprobes=(); for($x=0;$x<=$alltextlength-6;$x++) { $all= substr $genom, $j, 6; push(@allprobes,$all); } @probe=(); while($genom=~m/TATAAT.*?(ATG(...)*?(TAA|TAG|TGA))/g) { push (@gen, $1); } $cnt = 0; $k=0; $m=0; foreach $gen (@gen) { $length=length($gen); for($j=0; $j<$length-5; $j++) { $altilik= substr $gen, $j, 6; push (@probe,$altilik); while($allprobes[$m]=~m/$probe[$k]/g) { #push (@gen, $1); $cnt++; $k++; } $m++; #print "@probe\n\n\n"; #print @allprobes; } } print "$cnt\n";