my $sth = $dbh->preparecached(q(select primarykey from table where primarykey = ?)) or die "Couldn't prepare statement: " . $dbh->errstr;
$sth->execute; my ($count) = $sth->fetchrow
array; $sth->finish
unless ($count) {
...
}