sub interrupt { print "quitting!\n"; } $SIG{'INT'} = 'interrupt'; sleep 20; __END__ ^C quitting!