Perl exit Function


Advertisements


Description

This function 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.

Syntax

Following is the simple syntax for this function −

exit EXPR

exit

Return Value

This function does not return any value.

Example

Following is the example code showing its basic usage −


When above code is executed, it produces the following result −




Advertisements