Using the keys() function of Perl, you can easily get the count. The function used to return all the keys from the hash as array. But if you use a SCALAR variable, that case it will return you the element count from the hash.
my %hash = (red => 1, blue => 2, green => 3);
my $count = keys(%hash); ## Scalar requested.
Is there any other method to get the elements count from a Perl hash? I mean not using a loop.