my @values = qw/1 2 3/; my $sql = 'select * from foo where x in (' . join(', ', ('?') x @in_values) . ')'; $dbh->prepare($sql)->execute(@values);