my $against = join ' ', map {qq/"$_"/} @foo; while (my $PK = ) { chomp $PK; my $sth = $dbh->prepare(qq{ SELECT value FROM value_table WHERE primary_key = ? # no '+' so it can match against at least one of the words in the list AND MATCH (column_text_indexed) AGAINST (? IN BOOLEAN MODE) }); $sth->execute($PK, $against);