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.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.