$dbh=new db connection; test1($dbh); test2($dbh); sub test1 { $dbh->do(etc..); } sub test2 { $dbh->do(etc..); }