my $parent_dbh = DBI->connect( ... ); if( my $pid = fork() ) { # do stuff... # >>> $parent_dbh may be cleaned up here, # >>> because it *is* in the child's scope exit 0; } #### # fork first if( my $pid = fork() ) { # do stuff, including opening new DBI connection exit 0; } my $parent_dbh = DBI->connect(...); # do parent stuff #### my $parent_dbh = DBI->connect(...); $parent_dbh->{ InactiveDestroy } = 0; if(my $pid = fork()) { # do stuff }