my @valuesForIn = (1,2,3,4,5); my $placeholders = join ',' , map {"?"} @valuesForIn; my $query = qq~ SELECT field1 FROM table1 WHERE field2 IN ($placeholders) ~; my $sth1 = $dbh->prepare($query) or die->$errstr(); $sth1->execute(@valuesForIn) or die $dbh->errstr;