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


in reply to DBI and like statment

dunno if your DBD you're using can support placeholders, but if it does, you can do:
my $sql = "select title from $TABLE2 where astype like ?"; ... $sth->execute("%$query") or die "Cannot execute: " . $sth->errstr();

(update: chromatic advised me that I can't use placeholders for the table name. Fixed.)
(update2: chipmunk says that I can't use placeholders as part of a value. Well, the intention was right, but I guess I got this one COMPLETELY WRONG! Fixed that, too. Go upvote the other replies instead :o)

--
Me spell chucker work grate. Knead grandma chicken.