my @ids = ( 1, 2 ); my $value_lookup_sth = $dbh->prepare(" SELECT value WHERE id IN (" . join(',', ('?') x @ids ) . ") "); $value_lookup_sth->execute(@ids) or debug($DBI::errstr);