$sth = $dbh->prepare (qq{ SELECT * FROM table_name }); $sth->execute(); $row = $sth->fetchrow_hashref(); $sth->finish(); if ($sth) { #exists } else { # does NOT exist }