eval { $doc = $parser->parsefile ("$ARGV[0]"); }; if($@) { print "Invalid XML file,enter valid XML file \n"; exit; }