Adding to a bunch of other comments here, I've enjoyed combining Perl structures with BerkelyDB. As a multi-level nested data structure, I've found that MLDBM is a good source.

I do want to try and play devil's advicate for a little bit, though. I always (usuall sometimes) try to think a little harder of when I am using a hash to 'see if I can figure out a better way' and implement the same idea using an array instead. Here's my reasonings on that (and mind you, there have been only some rare occasions where I have really been able to better implement an algorithem with an array versus a Perl-ish hash.

I try to remember that a Perl hash is just an associative array. Whereas it is really an array of linked-lists. Therefore, no matter what, it can't be as fast as accessing an array directly. Not only does the key have to be hashed, but there inlies a chance it will have to iterate through n linked values before it finds the right key. Not to say this isn't blazingly fast, though not like the lightning you can pull out of an array index.

Like I said, there have been some seriously rare cases where I (or those amongst me) have been able to pull a smidgen of speed or efficiency out of an array implementation rather than a hash, although always something to put in the back of your mind.

print map{chr}(45,45,104,97,124,124,116,97,45,45);
... and I posted this while I was at work => whitepages.com | INC

In reply to Re: Perl's Hash vs BerkeleyDB vs MySQL by wazzuteke
in thread Perl's Hash vs BerkeleyDB vs MySQL by monkfan

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.