http://www.perlmonks.org?node_id=92411


in reply to Is there a way disconnect from database

You should set up a signal handler.

$SIG{INT} = \&some_subroutine;
will run the subroutine on a Ctrl-C.

$SIG{INT} = 'IGNORE';
will ignore Ctrl-C and the program will keep running.