$sth = $dbh->prepare("SELECT " . '? ' x $#selector . "FROM people WHERE (fornavn LIKE '%$search%') or (eternavn LIKE '%$search%') or (cpr LIKE '%$search%'", \%attr); #dunno if you can do the \%attr part... $sth->execute(@selector);