my $sqlc = "SELECT COUNT(*) FROM company_info"; my $crows= $dbh->selectrow_arrayref($sqlc); print $crows; #I did not use prepare or execute since I heard selectrow_arrayref wraps it around