if (!open($HANDLE, ">>filename.log")) { # call a sub-routine }