in reply to XML::Simple exit problem

The standard way to avoid dying is to wrap the call to XMLin within an eval block:

eval { $tmp_xml= XMLin("./$file"); } ; if( $@) { # something bad happened print "error in $file: $@\n"; } else { process( $tmp_xml); }

Just a few remarks: XML::Simple is not necessarily based on XML::Parser. If it can find a SAX parser around (XML::SAX::PurePerl or XML::LibXML) it will use it. And the above code does not work on my machine, as the parser does not seem to die when wrapped in an eval block (but dies properly when not wrapped...).

The proper way to do this is probably to have a separate step, where you parse the XMl through a simple XML checker (xmlwf comes with expat and xmllint with libxml2) before running your process, knowing that it will work on well-formed XML.