in reply to Parsing XML...by hand (ugh)

I've been told I can't use any external modules - only what comes with perl 5

If you're running on Windows, there's a good chance that your Perl installation shipped with at least one XML parser module. Both Activestate Perl and Strawberry Perl ship with XML::Parser and the underlying libexpat library. Strawberry Perl also includes XML::LibXML which would be a better choice than XML::Parser.

If you're not running on Windows then the XML parser libraries are probably readily available from your operating system's software package repositories.

While writing your own XML parsing code is a valuable learning experience, chances are an existing module would be a much better choice for deploying in production.