in reply to Re: Parsing through a menu hash.
in thread Parsing through a menu hash.

An easy support for n level depth can be afforded following merlyn's Recursively walk a hash to get to an element:
sub pointer_to_element { require List::Util; return List::Util::reduce(sub { \($$a->{$b}) }, \shift, @_); }
which allows you to write (untested!!!):
while(<DATA>) { chomp; my @chunks = split /\:/; next unless @chunks > 1; # At least one key, please my $value = pop @chunks; push @{ pointer_to_element($DATA, @chunks) }, $value; }

Flavio
perl -ple'$_=reverse' <<<ti.xittelop@oivalf

Don't fool yourself.