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


in reply to Getting a Hash Name

So why not simply extend your subroutine:

my %hash1 = ( one => 1, two => 2 ); check_limit(\%hash1, '%hash1'); sub check_limit { my $href = $_[0]; my $name = $_[1]; my $num = 0; for (keys %{$href}) { $num++ }; print "Hash '$name' has $num keys\n"; }