use strict; start_daemon(); # this runs Proc::Daemon::Init() and sets up some SIG stuff my $dbh = DBI->new(...); for(0..5){ my $pid = fork(); if ($pid) { next; } # Parent process: create the next child # Child: clone dbh, then do stuff my $childdbh = $dbh->clone(); $dbh->{InactiveDestroy}=1; undef $dbh; # Do stuff for(0..10){ subroutine($childdbh, @somevalues); } exit; # End of the child. } # Parent stuff goes here # Subroutines sub subroutine { my $childdbh = shift; $childdbh->do('this'); $childdbh->do('that'); $childdbh->do('the other'); another_subroutine( $childdbh, @othervalues ); } sub another_subroutine { my $childdbh = shift; $childdbh->do('even more stuff'); }