my $sth = $dbh->prepare('INSERT INTO table (foo,bar) VALUES (?,?)'); foreach my $value (keys %huge_data_set_to_insert) { $sth->execute($huge_data_set_to_insert{$value},$value); } $sth->finish();