while ($dna1 =~ s/\s/GA{ACT}TC/g){ print "Found GA{ACT}TC at", pos($dna1)-4, "\n"; }