in reply to Re: Re: pattern matching
in thread pattern matching
If you want to act on more than one id then try
The /g gets all matches of the regex, so the captured bit ($1,$2) will be updated for each match in the while loop.while ($arrayElement =~ /:ID\s(\d*).*:P_ID\s(\d*)/g ) { print $1,$2,"\n"; # just an example }
In Section
Seekers of Perl Wisdom