One helpful way to think of this problem may be to replace the cumbersome expression
$fileinfo{$md5hash}{path}
with a simpler, single scalar. That's what that big ugly thing holds after all, a scalar reference to an anonymous array structure. Something like
$aref=\@{$fileinfo{$md5hash}{path}}
would do the trick. Then you can use this scalar reference to your anonymous array like this:
$aref->[0]
$#$aref
for $x (@$aref) {...}
and so on.
This can be a handy technique sytactically, but also because it reminds you as the programmer what is really stored in those fancy complex data structures like the one you're using. They're just collections of scalar references to other collections, and as such can be passed around as an atomic piece of information. Of course, the correct DE-reference is crucial, but as you can see from above, you can just think of the expression "$aref" as another way of saying "that anonymous array over there". Then things like "$#$aref" (or $#{$aref} if you like) are not so alien.
Good luck with your data mining. Now just for fun, try adding time-lapse views of your filesystem to this structure :)
Paul
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.