local $SIG{HUP} = $SIG{TRAP} = ... = \&sig_message; ... sub sig_message { my $sig = shift; print STDERR "Got signal $sig\n"; }