in reply to XML tagging problem

Are you sure that @newHits contains the data you think it contains? Try printing it to standard output before writing the XML file to make sure. Did you mean to pass @newHits as arguments to the writeXML subroutine?