my $sth= $dbh->prepare("select * from mytable where ? = ?"); ... $sth->execute( $colname, $value );