- exit EXPR
 - exit
 - 
Evaluates EXPR and exits immediately with that value. Example:
EXPR を評価し、即座にその値を持って終了します。 例:
my $ans = <STDIN>; exit 0 if $ans =~ /^[Xx]/;See also die. If EXPR is omitted, exits with
0status. The only universally recognized values for EXPR are0for success and1for 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.die も参照してください。 EXPR が省略された場合には、ステータスを
0として終了します。 EXPR の値として広く利用可能なのは0が成功で1が エラーということだけです; その他の値は、 Perl が実行される環境によって異なる 解釈がされる可能性があります。 例えば、sendmail 到着メールフィルタから 69 (EX_UNAVAILABLE) で終了すると メーラーはアイテムを配達せずに差し戻しますが、 これはいつでも真ではありません。Don't use
exitto 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.誰かが発生したエラーをトラップしようと考えている可能性がある場合は、 サブルーチンの中断に
exitを使わないでください。 代わりに eval でトラップできる die を 使ってください。The
exitfunction does not always exit immediately. It calls any definedENDroutines first, but theseENDroutines may not themselves abort the exit. Likewise any object destructors that need to be called are called before the real exit.ENDroutines and destructors can change the exit status by modifying$?. If this is a problem, you can callPOSIX::_exit($status)to avoidENDand destructor processing. See perlmod for details.exit関数は常に直ちに終了するわけではありません。 まず、定義されているENDルーチンを呼び出しますが、ENDルーチン自身は exit を止められません。 同様に、呼び出す必要のあるオブジェクトデストラクタは すべて、実際の終了前に呼び出されます。ENDルーチンとデストラクタは$?を修正することで 終了コードを変更できます。 これが問題になる場合は、ENDやデストラクタが実行されることを 防ぐためにPOSIX::_exit($status)を呼び出してください。 詳しくは perlmod を参照してください。Portability issues: "exit" in perlport.
移植性の問題: "exit" in perlport。