icon Top 9 categories map      RocketAware > Perl >

exit EXPR

Tips: Browse or Search all pages for efficient awareness of Perl functions, operators, and FAQs.



Home

Search Perl pages


Subjects

By activity
Professions, Sciences, Humanities, Business, ...

User Interface
Text-based, GUI, Audio, Video, Keyboards, Mouse, Images,...

Text Strings
Conversions, tests, processing, manipulation,...

Math
Integer, Floating point, Matrix, Statistics, Boolean, ...

Processing
Algorithms, Memory, Process control, Debugging, ...

Stored Data
Data storage, Integrity, Encryption, Compression, ...

Communications
Networks, protocols, Interprocess, Remote, Client Server, ...

Hard World
Timing, Calendar and Clock, Audio, Video, Printer, Controls...

File System
Management, Filtering, File & Directory access, Viewers, ...

    
exit EXPR
Evaluates EXPR and exits immediately with that value. (Actually, it calls any defined 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 universally 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().

Source: Perl builtin functions
Copyright: Larry Wall, et al.
Next: exp EXPR

Previous: exists EXPR



(Corrections, notes, and links courtesy of RocketAware.com)


[Overview Topics]

Up to: Current Process Control
Up to: PERL




Rapid-Links: Search | About | Comments | Submit Path: RocketAware > Perl > perlfunc/exit.htm
RocketAware.com is a service of Mib Software
Copyright 2000, Forrest J. Cavalier III. All Rights Reserved.
We welcome submissions and comments