Documentation for variable $!
assembled from the following pages:
Language documentation: Variables §
From Variables
(Variables) variable $! §
$!
is the error variable. A fresh one is created in every routine. If a try
block or statement prefix catches an exception, that exception is stored in $!
. If no exception was caught, $!
is set to Nil
.
Note that CATCH
blocks do not set $!
. Rather, they set $_
inside the block to the caught exception.
Also note that the same thread-safety issues apply to the use of $!
as they do to $/
.