http://www.perlmonks.org?node_id=1086664


in reply to PERL DBI MODULE

As said by others, your quest is kinda dubious.

My first warning/quest after reading the OP is: "Do you really mean to match coln1 against a literal '?'?

If you want to match against a parameter in the execute that will not DWIM at all.

my %sth = map { $_ => $dbh->prepare ("select * from foo where $_ = ?") + } qw( coln1 coln2 coln3 ); # Note the unquoted ? $sth{coln1}->execute ($coln1_val); # query for coln1 executed with ? r +eplaced with $coln2_val

Enjoy, Have FUN! H.Merijn