warn

Prints the value of LIST to STDERR. If the last element of LIST does
not end in a newline, it appends the same file/line number text as die
does.

If the output is empty and $@
already contains a value (typically from a
previous eval) that value is used after appending "\t...caught"
to $@
. This is useful for staying almost, but not entirely similar to
die.

If $@
is empty then the string "Warning: Something's wrong"
is used.

No message is printed if there is a $SIG{__WARN__}
handler
installed. It is the handler's responsibility to deal with the message
as it sees fit (like, for instance, converting it into a die). Most
handlers must therefore arrange to actually display the
warnings that they are not prepared to deal with, by calling warn
again in the handler. Note that this is quite safe and will not
produce an endless loop, since __WARN__
hooks are not called from
inside one.

You will find this behavior is slightly different from that of
$SIG{__DIE__}
handlers (which don't suppress the error text, but can
instead call die again to change it).

Using a __WARN__
handler provides a powerful way to silence all
warnings (even the so-called mandatory ones). An example: