Even notionally simple perl code pattern matching tasks like "find the comments" are made difficult by the nature of perl:
Perl Cannot Be Parsed: A Formal Proof by Jeffrey Kegler on perlmonks talks about this issue, noting that it is of historical interest.
Perl and Undecidability provides links to further articles written by Jeffrey Kegler on the same issue.
Adam Kennedy's PPI is a module which attempts to solve the problem 'enough' to get a bunch of perl document parsing jobs done.