in reply to no exit!

Hmm, it is a bit difficult to answer your question when we don't know what the dwindex and getinserts subroutines do, and what the arguments ( the $dbh, $script and $insert parameters) are supposed to be.