You are viewing the version of this documentation from Perl blead. This is the main development branch of Perl. (git commit 0e943cea3fcecac62e3bc5ec5d0f05d2c3859010)
$EXCEPTIONS_BEING_CAUGHT
$^S

Current state of the interpreter.

$^S         State
---------   -------------------------------------
undef       Parsing module, eval, or main program
true (1)    Executing an eval or try block
false (0)   Otherwise

The first state may happen in $SIG{__DIE__} and $SIG{__WARN__} handlers.

The English name $EXCEPTIONS_BEING_CAUGHT is slightly misleading, because the undef value does not indicate whether exceptions are being caught, since compilation of the main program does not catch exceptions.

This variable was added in Perl 5.004.