Copyright © tutorialspoint.com

PERL exit Function


Syntax

exit EXPR

exit


Definition and Usage

Evaluates EXPR, exits the Perl interpreter, and returns the value as the exit value.Always runs all END{} blocks defined in the script (and imported packages) before exiting. If EXPR is omitted, then the interpreter exits with a value of 0. Should not be used to exit from a subroutine; either use eval and die or use return.

Return Value

  • Nothing.

Example

Following are the usage...

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

Copyright © tutorialspoint.com