You can put the whole term in the look-ahead to make things a bit simpler and you could take advantage of the $scalar = () = $string =~ m{$pattern}g; idiom rather than successive incrementing, wrapping the whole thing in a map.
$ perl -Mstrict -wle ' > my $seq = q{GGGGGGGAGAAAAAAAAAAAAAAAGAAGGA}; > my @pats = qw{ AAAAA GGGGG GGAGA GAAGG }; > my @cts = map { > my $re = qr{(?=\Q$_\E)}; > my $ct = () = $seq =~ m{$re}g; > } @pats; > print qq{@cts};' 11 3 1 1 $
I hope this is of interest.
Cheers,
JohnGG
In reply to Re^2: Regex KungFu help needed
by johngg
in thread Regex KungFu help needed
by drblove27
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |