If you mean how many keys, then all you have to do is use the keys() function in a scalar context:
$num_keys = keys %hash;The keys() function also resets the iterator, which means that you may see strange results if you use this between uses of other hash operators such as each().