16.15.3. Discussion
Perl uses the %SIG hash to control what happens
when signals are received. Each key in %SIG
corresponds to a signal. Each value is the action to take when Perl
receives the corresponding signal. Perl provides two special
behaviors: "IGNORE" to take no action when a
particular signal is received, and "DEFAULT" to
perform the default Unix action for that signal.
Although a C programmer might think of a signal as
SIGINT, Perl uses just INT.
Perl figures you only use signal names in functions that deal with
signals, so the SIG prefix is redundant. This
means that you'll assign to $SIG{CHLD} to change
what your process does when it gets a SIGCHLD.
If you want to run your own code when a given signal is received, you
have two choices of what to put in the hash: either a code reference
or a subroutine name. (This means you can't name a signal handler
IGNORE or DEFAULT if you store the string, but they'd be mighty
strange names for signal handlers anyway.) If you use a subroutine
name that isn't qualified by a package, Perl will interpret this name
to be a function in the main:: package, not one in
the package in which the handler was installed. A code reference
refers to a subroutine in a particular package, so it is a better
choice.
Perl calls your handler code with a single argument: the name of the
signal that triggered it, such as "INT" or
"USR1". Returning from a signal handler takes you
back to whatever you were doing when the signal hit.