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