Looks like my login timed out whilst posting original.
Thanks for responses. As I say I'm very new to Perl, ie. a couple of days, and not sure I fully understand the first response and cannot get XML::Twig to compile.
Writing Makefile for XML::Twig
malformed JSON string, neither array, object, number, string or atom,
+at character offset 0 (before "(end of string)") at Makefile.PL line
Therefore ideally a solution with XML::Simple or XML::LibXML would be preferable if possible. I think I'm close with the existing code just maybe not quite understanding something.