in reply to Re^2: How to extract a row or column of two-dimensional hash
in thread How to extract a row or column of two-dimensional hash

The error message "Type of arg1 to values must be hash (not hash element)" is giving you precisely the fix you need.

$HoH{$group} is a hash element. The keys function you have in front of it wants a hash, not a hash element. Since that hash element is a reference to the actual hash, you must dereference the reference to get to the hash. In this case, wrap %{ ... } around it, as in %{$HoH{$group}}, and put keys in front of that.

I'm surprised you checked "3 llamas". The llama doesn't talk about references (deliberately, because there's only so much we can cover in a week). You want The Alpaca instead, which covers this topic (and more!).