use strict; use warnings; #this doesn't work #$ENV{PERL_SIGNALS} = "unsafe"; local $SIG{INT} =sub { print "in SIGINT ...exitting\n"; #here I want disconnect from database; exit; }; while (1){ print "in while loop\n"; sleep 30; #this is what I can do best so far... #sleep 3 for (0 .. 10); }