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


in reply to matching substrings on each line

Did I understand correctly, that you want to ?