my @ids = (1,2,3,4); my $query = 'select * from a_table where id in (??)'; my $result = $dbh->query($q, @ids);