in reply to num keys of the hash within hash?

Use keys in scalar context. ie
my $count = keys %hash;

or

my $count = keys %{$hash{first}};

if you've got a hash of hashes