--- name: die status: documented runtime: pp source: src/runtime/pp/system.rs --- ```{index} single: die; Perl built-in (pp runtime) ``` # die ## Synopsis ```perl die "something went wrong"; die "Error at $file line $line\n"; die $exception_object; die; # re-raises $@ ``` ## Description Raises an exception, terminating execution unless caught by an eval block or a `try`/`catch` construct. If called with a string argument, raises that string as the exception message. If the string does not end with a newline, Perl appends ` at FILE line LINE`. If called with a reference (e.g. a hashref or blessed object), the reference is propagated as the exception value in `$@`. When called with no arguments (or an empty string / undef), re-raises the current value of `$@`. If `$@` is also empty, dies with `"Died"`. If there is an active try block (from `use feature 'try'`), the exception is caught and execution transfers to the catch block instead of propagating. ## See also warn, eval