Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

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

by Discipulus (Canon)
on Dec 19, 2015 at 22:20 UTC ( #1150774=note: print w/replies, xml ) Need Help??


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.

Replies are listed 'Best First'.
Re^2: Using File::Find to create a hash of directory structure.
by Anonymous Monk on Dec 19, 2015 at 22:53 UTC
      Thank you -- yours and the other reply give me something to think about.
Re^2: Using File::Find to create a hash of directory structure.
by AnaximanderThales (Novice) on Dec 21, 2015 at 21:06 UTC
    Thank you -- your reply and the other reply to your post give me something to think and look at to see what I can figure out.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1150774]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (2)
As of 2023-10-02 18:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?