in reply to position after global matches?
while (/TATA/g) { print "Matched 'TATA' at position ", pos, "\n"; pos() -= 2; }
and
while (/TA(?=TA)/g) { print "Matched 'TATA' at position ", pos, "\n"; }
(?=TA) is a zero-width positive look-ahead assertion and is documented in perlre
Both these techniques also match at 2 which might not be what you're after
|
|---|