http://www.perlmonks.org?node_id=1069261


in reply to Storing pattern matches

May be you should look at Regexp::Grammars. It allows to parse relatively complex texts in declarative way.