411 REFERENCE · Wikibooks
Perl Programming/Keywords/die
Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.
Perl DESTROY do Keywords
The die keyword
The die comment raises an exception. If called inside an eval(), its message is stuffed into $@, and eval() returns with the undef. If the exception is outside of all enclosing eval()s, the uncaught exception prints LIST to STDERR and exits with a non-zero value. For a specific exit code, exit should be called.
Syntax
die LIST
Examples
chdir '/usr/spool/news' or die "Cannot change to directory spool: $!\n"
Perl DESTROY do Keywords