perldoc > exit(0)

📖 NAME

exit — Exit Perl interpreter

🚀 Quick Reference

Use CaseCommandDescription
Exit with successexit 0Exit with status 0 (success)
Exit with errorexit 1Exit with status 1 (error)
Exit with specific statusexit 69Exit with application-specific status (e.g., EX_UNAVAILABLE)
Abort subroutine with exceptiondieThrow an exception that can be caught by eval
Immediate exit without cleanupPOSIX::_exit($status)Bypass END and destructor processing

💻 SYNOPSIS

exit EXPR
exit

📖 DESCRIPTION

Evaluates EXPR and exits immediately with that value. 🚪 Example:

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

See also 🔴 die. If EXPR is omitted, exits with 0 status. The only universally recognized values for EXPR are 0 for success and 1 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.

Don'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.

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

Portability issues: exit in perlport.

exit(0)
📖 NAME 🚀 Quick Reference 💻 SYNOPSIS 📖 DESCRIPTION

Generated by phpman v4.9.26-5-g7740029 · Markdown · JSON · MCP Author: Che Dong Under GNU General Public License
2026-08-09 12:40 @216.73.216.150
CrawledBy Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
Valid XHTML 1.0 Transitional!Valid CSS!