open IN, "nofile1" or &kill("message"); sub kill{ print "HANDLE the message"; #And if you need to exit from here }