in reply to Generating Hashes from arrays of arbitrary size
Should the first Item2 be something different from the second because it's a leaf?Item1--Item2 Item1--Item2--Item3
In my solution below, I'm assuming that the answer is "no".
my %h; while (<>) { chomp; my @v = split; my $h = \%h; for ( @v ) { $h->{$_} ||= {}; $h = $h->{$_}; } }
|
|---|