eval { #any code in here yourSub(); } if ($@){ # $@ contains err message if error occurs warn " continue with script but there has been an erro $@ \n"; #run error handling routine ErrorHandle(); } #### ErrorDocument 404 /missing.html ErrorDocument 401 /auth_error.html