in reply to Program hangs
Trying running the code with perl -wc programname.pl as this has caught many hangs that I've experienced (sometimes just a closing multi-line quote missing can hang the entire thing).
Use use strict; as well to double-check everything, and if need be add debug lines (printing to the console - not to a file: you'll have less to go wrong if it is displayed rather than written) after every statement.
Oh, since you're using Oracle (I'm guessing via DBI), ensure that all your modules are up-to-date and turn on debugging on the DBI module as that will help as well.