Perl script to read and modify an XML template, modify it, and output it to another XML file