use threads; use DBI; my $dbh = DBI->connect( ); $SQL_1 = "SELECT * FROM x"; $SQL_2 = "SELECT * FROM y"; $SQL_3 = "SELECT * FROM z"; sub start_thread { my ($dbh,$SQL) = @_; # print('Thread started: ', SQL, "\n"); my $sth = $dbh->prepare($SQL); $sth->execute(); < Add your code here > } my $thr1 = threads->create('start_thread', $dbh, $SQL_1); my $thr2 = threads->create('start_thread', $dbh, $SQL_2); my $thr3 = threads->create('start_thread', $dbh, $SQL_3); $thr1->join(); $thr2->join(); $thr3->join();