in reply to Perl and mysql connections
perl -d:DProf script.pl [download]
and then use dprofpp to see which perl subroutine is causing the delay. From that you may be able to figure out where the problem lies.
See Devel::DProf for more details.
dave hj~