my $dbh = DBI->connect( $whatever… ) ... my $sth = $dbh->prepare( "select field from table where id != ?" ); $sth->execute( '$in{cid}' ); # an 8-character string is the placeholder value ...