http://qs321.pair.com?node_id=11135937


in reply to Re^3: Not sure how to handle this scope (updated)
in thread Not sure how to handle this scope

Maybe give the inner variable a different name and assign it the value from the "main" handle in the non-fork case?

my $main_dbh = DBI->connect(...); while( 1 ) { my $dbh; if( $forked ) { $dbh = DBI->connect(...); } else { $dbh = $main_dbh; }; $dbh->selectall_arrayref($sql); }