For complex and recursive parsing in Perl, the Parse::RecDescent module by Damian Conway is that against which other such modules are measured. The learning curve for this module can be relatively steep, but I would recommend taking a look at the article "the man(1) of Descent" in Issue 12 of The Perl Journal and the Parse::RecDescent::FAQ.