I've got the book (Programming the Perl DBI, Descartes & Bunce). Notice it's about DBI; I'd suggest using it if you can at all (I converted a project from using AnyDBM to MySQL and it saved me about 50% of the code and 90% of the headache).

That said, if you're still stuck with DBMs, use Berkeley DB if at all possible; the rest just plain suck for anything more than pure hash usage. Grab DB_File from CPAN and see if you can just drop in the .pm; it sometimes works without a make. At least one of the others comes with perl, and they're pretty similar feature-wise. AnyDBM just uses one of these(from perldoc AnyDBM_File, the search order is ndbm, db_file, gdbm, sdbm, odbm), so you must have one of those five.

Like btrott wrote, the $DB_HASH, $DB_BTREE, and $DB_RECNO formats are only supported by DB_File. I don't think you were trying (I did, I'll save you the pain of figuring it out :), but the neat trick the book has of using $DB_BTREE with R_DUP to allow duplicate keys doesn't work with anything other than DB_File.


In reply to RE: RE: Re: Any_DBM_File blues. by athomason
in thread Any_DBM_File blues. by skazat

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.