in reply to look for substrings and getting their location
$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.
|
|---|