http://www.perlmonks.org?node_id=1150774


in reply to Using File::Find to create a hash of directory structure.

welcome AnaximanderThales

I've not so much time now, but recursive directory parse is the oldest question here at PM:
see Recursive Directory print Descending a directory tree, returning a list of files as recent examples. In both I point to the tachyon's recursive.. eehm iterative solution: it is simple and you can extend it at will. You'll find the original tachyon's post with plain explanation here

The code you point to is a little obscure, indeed
my $r = \%root; my $tmp = $name; $tmp =~ s/^\Q$root_path\E//; $r = $r->{$_} ||= {} for split m|/|, $tmp; #/ $dl{$name} ||= $r;
Is something like: r is a ref to root hash. Then r is equal to the x key value of the root hash or an empty hash. this repeted for each part of the path splitted at separator. Then if dl_name is defined ok, if it is not defined take r. see Or, Or, Equals Zero, $x ||= 0

I cannot see a meaning in this..but i'm tired now.

Best wishes
L*
There are no rules, there are no thumbs..
Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.