my $dbh = DBI->connect(...); my $sth = $dbh->prepare(...); ... $dbh->finish(); #### $sth->finish();