in reply to positions of multiple matches

Here's how to match and set the pos in one line:
use re 'eval'; my $seq = 'xxxTATAATGyyyTatAtAtzzz'; my $box = qr{ (?i) TATA [TA] [TA] [TAG] }xms; ;; my @TATAs; my @matches = $seq =~ m{ ($box) (?{ push @TATAs,[$+,pos() - length $+] }) }msxg; print "matched '$_->[0]' at pos $_->[1]\n" for @TATAs;
The 'magic' is in the (?{ ... }) construct. This allows you to insert perl into your regexen.