in reply to Counting keys in a referenced hash

You are using symbolic references. Your second hash is in fact %3. If you had been using strict, you'd have known:

Can't use string ("3") as a HASH ref while "strict refs" in use ...

You would get a real hashref (which you are obviously trying to get), if you had used the hash constructor, {...}, instead of the parentheses.

But the real lesson you should learn here, that might save you both time and future embarrassment, is the same old:

use strict; use warnings;

print "Just another Perl ${\(trickster and hacker)},"
The Sidhekin proves Sidhe did it!