Cari di Perl 
    Perl User Manual
Daftar Isi
(Sebelumnya) Turn a BLOCK into a TERMCreate spaghetti code (Berikutnya)
Keywords related to control flow of your perl program

Terminate this program

Daftar Isi

  • exit EXPR

  • exit

    Evaluates EXPR and exits immediately with that value. Example:

    1. $ans = <STDIN>;
    2. exit 0 if $ans =~ /^[Xx]/;

    See also die. If EXPR is omitted, exits with 0 status. The onlyuniversally recognized values for EXPR are 0 for success and 1for error; other values are subject to interpretation depending on theenvironment in which the Perl program is running. For example, exiting69 (EX_UNAVAILABLE) from a sendmail incoming-mail filter will causethe mailer to return the item undelivered, but that's not true everywhere.

    Don't use exit to abort a subroutine if there's any chance thatsomeone might want to trap whatever error happened. Use die instead,which can be trapped by an eval.

    The exit() function does not always exit immediately. It calls anydefined END routines first, but these END routines may notthemselves abort the exit. Likewise any object destructors that need tobe called are called before the real exit. END routines and destructorscan change the exit status by modifying $?. If this is a problem, youcan call POSIX::_exit($status) to avoid END and destructor processing.See perlmod for details.

    Portability issues: exit in perlport.

 
Source : perldoc.perl.org - Official documentation for the Perl programming language
Site maintained by Jon Allen (JJ)     See the project page for more details
Documentation maintained by the Perl 5 Porters
(Sebelumnya) Turn a BLOCK into a TERMCreate spaghetti code (Berikutnya)