in reply to How to get the correct count

while($k=~ /[AG]TG.*T[AG][AG]/ig){$GENE++}
This is probably not doing what you expect, because the quantifier * is greedy. You might change it to
while($k=~ /([AG]TG.*T[AG][AG])/ig){$GENE++; print "$1\n";}
to see what happens. (The new code stores the matching part (using () ) to the special variable $1 and prints it).

HTH, Rata