my $xp = XML::XPath->new(filename => $open_this); #####Test my ($parser,$list_item,$file_list,$root_node); eval { $parser = XML::XPath::XMLParser->new( filename => $xp-> $open_this); $root_node = $parser->parse; $xp->find('/*', $root_node); }; if ($@) { # if we get an error, include the details in the output. $list_item->appendChild(XML::XPath::Node::Text->new("ERROR parsing file '$open_this': ". $@) ); $file_list->appendChild($list_item); next FILE; }