When you
exit() from perl, it will close all open filehandles and free all variables. As for database connections, I believe it will attempt to close it, but I get the feeling that it is largely dependent on how your database driver handles disconnections. But generally it's pretty safe to
exit() from perl at all but the most crucials of times (and even then it's pretty sturdy).
HTH
broquaint