in reply to Lost JJC and XML

First thing I would do is run Perl::Tidy on that code which would make it more readable, and as an added bonus, should catch a lot of unbalanced parentheses.