in reply to Assign a value to a hash of unknown nodes

Quick and dirty. (Well, dirty anyway.)

>perl -wMstrict -le "use Data::Dumper; ;; my @lines = qw(a/b/c/d/e a/b/c/f a/g x/y); my %hash; for my $line (@lines) { eval qq{\$hash{ @{[ join '}{', split qr{/}xms, $line ]} } = 1;}; } print Dumper \%hash; " $VAR1 = { 'a' => { 'g' => 1, 'b' => { 'c' => { 'd' => { 'e' => 1 }, 'f' => 1 } } }, 'x' => { 'y' => 1 } };