Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Unfortunately, only the first match is located and stored in the array. I am also considering capturing the beginning and ending index of each match (reading left to right). Any suggestions would be appreciated.use strict; use warnings; my $dna = 'xxxxxxpecbcbccrlxxxxxxpeeeerlxxxxxplxxxxxPeRLxxxx'; my @matches; if ($dna =~ /(p.*?l)/gi) { push @matches, $1; } for (@matches) { print $_, "\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Find and extract substring(s) within larger string.
by Athanasius (Archbishop) on Oct 21, 2013 at 03:47 UTC | |
by Anonymous Monk on Oct 21, 2013 at 04:14 UTC | |
by Athanasius (Archbishop) on Oct 21, 2013 at 04:41 UTC | |
by Anonymous Monk on Oct 21, 2013 at 04:51 UTC | |
by AnomalousMonk (Archbishop) on Oct 21, 2013 at 23:37 UTC | |
|
Re: Find and extract substring(s) within larger string.
by 2teez (Vicar) on Oct 21, 2013 at 06:33 UTC | |
by hdb (Monsignor) on Oct 21, 2013 at 07:29 UTC | |
by 2teez (Vicar) on Oct 21, 2013 at 07:56 UTC |