http://www.perlmonks.org?node_id=63038

Malkavian has asked for the wisdom of the Perl Monks concerning the following question: (hashes)

Is there any fast way of finding the number of elements in a hash without first assigning an array of keys of a hash?
Basically, I don't like the overhead of doing the operation:

@array=keys(%hash); $size=$#array;

It just seems a little wasteful. If anyone can point out a quickie answer, I'd be hideously grateful

Cheers,

Malk

Originally posted as a Categorized Question.