in reply to Generating .xml file after creating xml data from XML::LibXML
See open and print on how to print the output to a file instead of the console.