Evaluates EXPR and exits immediately with that value. Example:
- $ans = <STDIN>;
- exit 0 if $ans =~ /^[Xx]/;
die. If EXPR is omitted, exits with
status. The only
universally recognized values for EXPR are
for success and
for error; other values are subject to interpretation depending on the
environment in which the Perl program is running. For example, exiting
69 (EX_UNAVAILABLE) from a sendmail incoming-mail filter will cause
the mailer to return the item undelivered, but that's not true everywhere.
The exit() function does not always exit immediately. It calls any
routines first, but these
routines may not
themselves abort the exit. Likewise any object destructors that need to
be called are called before the real exit.
routines and destructors
can change the exit status by modifying
. If this is a problem, you
to avoid END and destructor processing.
See perlmod for details.
Portability issues: exit in perlport.