in reply to PERL DBI MODULE

Strongly agree.   You will need to run separate queries, and if the actual number of queries to be run is not unreasonably large, I would definitely prefer to read code that just repeats itself just repeats itself just repeats itself.   Because, that way, when, not if one of the cases has to be changed, you can easily do so because they are not “tightly coupled” to one another ... you just change the one.   And, each one of them is very clear, very easy to understand.

If you do find that you need to change only the field-name, and the set of field-names is known trustworthy, then you can easily do that by ordinary string interpolation, e.g.:

for my $field_name (qw/field1 field2 field3/) { my $sql = "select * from table1 where $field_name = '?'"; ...
Since double-quotes are used, the value of $field_name will be interpolated into the string. ... and in this case what you are emphasizing to the Gentle Programmer who will follow in your footsteps is that the queries are exactly the same except for this name.   Notice that in the resulting query-strings I am still using a placeholder ... '?' ... and I will still provide the field’s value to each query in that manner.   I will execute each query in turn and in some useful manner accumulate the results.