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