my $res = $dbh->selectall_hashref($stmt, $key); print scalar(keys %$res); #### my $res = $dbh->selectall_arrayref($stmt); print scalar(@$res);