Prints message to the standard error output and exits the Perl
program with a nonzero exit status. message can be a list value, like
the arguments to
\n), the current script filename, line number, and
input line number (if any) are appended to the message with a newline.
With no argument, the function outputs the string
Died as its
die exits the programs with the current value of the
variable, which contains the text describing the most recent operating
system error value. This value can be used in the message to
describe what the problem may have been.
die behaves differently inside an
eval statement. It
places the error message in the
$@ variable and aborts the
eval, which returns an undefined value. This use of
can raise runtime exceptions that can be caught at
a higher level of the program.