$count= @{[$string=~ /GUAUG/g]};
A bit inefficent if there are a lot of matches, using a /g regexp in scalar context would be better.
Update: The locations too? Than you'll need a /g regexp in scalar context and read $-[0] after each match.
In reply to Re: look for substrings and getting their location
by ambrus
in thread look for substrings and getting their location
by wolffm
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |