Monthly Archives: June 2004

Test for existing data in a db w/ perl.

my $sth = $dbh->prepare_cached(q(select primary_key from table where primary_key = ?)) or die “Couldn’t prepare statement: ” . $dbh->errstr; $sth->execute; my ($count) = $sth->fetchrow_array; $sth->finish unless ($count) { … }

Posted in Blog | Comments Off