=over =item $OS_ERROR =item $ERRNO =item $! X<$!> X<$ERRNO> X<$OS_ERROR> When referenced, C<$!> retrieves the current value of the C C integer variable. If C<$!> is assigned a numerical value, that value is stored in C. When referenced as a string, C<$!> yields the system error string corresponding to C. Many system or library calls set C if they fail, to indicate the cause of failure. They usually do B set C to zero if they succeed. This means C, hence C<$!>, is meaningful only I after a B: if (open my $fh, "<", $filename) { # Here $! is meaningless. ... } else { # ONLY here is $! meaningful. ... # Already here $! might be meaningless. } # Since here we might have either success or failure, # $! is meaningless. Here, I means that C<$!> may be unrelated to the outcome of the C operator. Assignment to C<$!> is similarly ephemeral. It can be used immediately before invoking the C operator, to set the exit value, or to inspect the system error string corresponding to error I, or to restore C<$!> to a meaningful state. Mnemonic: What just went bang? =back