foreach (qw/HUP QUIT KILL TERM/) { my $msg = "slugged by a $_"; $SIG{$_} = sub {warn $msg}; }