$SIG{INT}= 'handler'; sub handler { print "Got ctrl-Cd\n"; exit(0); } while (1) { sleep 1; }