my $rows = $sth->fetchall_arrayref() my $num_rows = scalar (@$rows);