sub whatever_its_called { my ($dbh) = DBI->connect(...); sub do_hit { $dbh->prepare("stuff"); } }