if ($!) { print "Error occured: $!"; # reset the error so that we can catch next genuine error condition $! = 0; }