You need to call the /g -modified regex in list context:
13:42 >perl -wMstrict -e "my $dna = 'xxxxxxpecbcbccrlxxxxxxpeeeerlxxxx +xplxxxxxPeRLxxxx'; my @matches = $dna =~ /(p.*?l)/gi; print qq[$_\n] +for @matches;" pecbcbccrl peeeerl pl PeRL 13:42 >
See “Global Matching” in Using regular expressions in Perl.
Hope that helps,
| Athanasius <°(((>< contra mundum | Iustus alius egestas vitae, eros Piratica, |
In reply to Re: Find and extract substring(s) within larger string.
by Athanasius
in thread Find and extract substring(s) within larger string.
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |