in reply to killing perl scripts

For Ctrl^C or kill -INT, use a signal handler:
$SIG{INT} = sub { $dbh->disconnect if $dbh };
AFAIK, nothing you can do about kill -9; perhaps you oughtn't to be using -9 habitually?