DIE and EXIT are two library functions in Perl to exit the program. The difference between DIE and EXIT is that DIE exits the program and prints a specified message. Exit simply exits the program.
Example :
open(myfile,filename) ||DIE(“File cannot be opened\n”);
The above line of code will print a message “File cannot be opened” in case if open fails and then exits the program.