Documentation for sub
exit assembled from the following types:
From Independent routines
multi sub exit()multi sub exit(Int(Any) )
Exits the current process with return code
$status or zero if no value has been specified. The exit value (
$status), when different from zero, has to be opportunely evaluated from the process that catches it (e.g., a shell); it is the only way to return an exit code different from zero from a Main.
exit should be used as last resort only to signal the parent process about an exit code different from zero, and not to terminate exceptionally a method or a sub: use exceptions instead.