in reply to killing perl scripts

to make sure that most signals will trigger the closing, use an END-block:

END { $dbh->disconnect }
in conjunction with sigtrap to trap al signals (which are trappable!):

use sigtrap qw(die normal-signals);

Paul