END routines first, but the END routines may not abort the exit. Likewise any object destructors that need
to be called are called before exit.) Example:
$ans = <STDIN>;
exit 0 if $ans =~ /^[Xx]/;
See also die. If
EXPR is omitted, exits with 0 status. The only univerally portable values for
EXPR are 0 for success and 1 for error; all other values are subject to unpredictable interpretation depending on the environment in which the Perl program is running.
You shouldn't use exit to abort a subroutine if there's any
chance that someone might want to trap whatever error happened. Use
die instead, which can be trapped by an eval.