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


in reply to Iterating through a HoHoH ... does a particular sub-hash exist?

$cmdData->{command_1}{subfields} is defined. It's an array reference.
$cmdData->{command_2}{subfields} is defined. It's an array reference.

Sounds like you want to check the number of elements in the referenced array. That would be

@{ $cmdData->{$cmd}{subfields} }
in scalar context.