in reply to Arbitrarily Nested HoH

I'd make the second argument optional, so that the initial call to your subroutine is as simple as it could be.

output_hash(\%data); sub output_hash { my ($href, $item) = @_; die "Not a hashref" if ref($href) ne 'HASH'; $item ||= []; ... }