{ my @path; sub hash_gen { my $cats = shift; unless (ref $cats eq 'HASH') { pop @path; return undef; } my ($output, $level) = ('', 0); foreach my $cat (sort {uc($a) cmp uc($b)} keys % $cats) { push @path, $cat; $output .= '