[Melbourne-pm] How to parse n matches out of a string?

Nathan Bailey web at polynate.net
Sat Mar 26 04:00:58 PDT 2016


Is there a 'best practice' idiom for parsing out multiple matches from a
string, ie.
   'blahMatchblah blah blahMatch blah blahMatchblah'

Previously I've done:
  while (my ($match,$rest) = $string =~ m#(Match)(.*)) {
     $string = $rest;
  }
which works, but seems inelegant.

Is there a better/recommended way?

cheers,
Nathan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/melbourne-pm/attachments/20160326/16ad55b1/attachment.html>


More information about the Melbourne-pm mailing list