sub sig_handler { my $signal = shift; die "I got signal $signal"; } $SIG{INT} = \&sig_handler; while(<>) { print; }