#Take the same $sth from the previous example my @data_to_query = ( #You would probably get this from somewhere else { id => 763, bar => "baz" }, { id => 923, bar => "qux" }, #...and so forth ); foreach( @data_to_query ) { $sth->execute( $_->{id}, $_->{bar} ); #do something with that dataset }