|P is for Practical|
read the perldocs for the modules. these are nothing more than persistant (saved to disk) versions of the familiar hash with some extra restrictions.
quoth perdoc AnyDBM:
DBM Comparisons Here's a partial table of features the different packages offer: odbm ndbm sdbm gdbm bsd-db ---- ---- ---- ---- ------ Linkage comes w/ perl yes yes yes yes yes Src comes w/ perl no no yes no no Comes w/ many unix os yes yes no no no Builds ok on !unix ? ? yes yes ? Code Size ? ? small big big Database Size ? ? small big? ok Speed ? ? slow ok fast FTPable no no yes yes yes Easy to build N/A N/A yes yes ok Size limits 1k 4k 1k none none Byte-order independent no no no no yes Licensing restrictions ? ? no yes nothe different dbm modules all work about the same, just have different file formats and limitations. AnyDBM is a wrapper to hide those differences from the programmer, it will let you use the same code to open an NDBM or SDBM or ODBM format file.
each time you run the code %h will be just like it was and you should see the counter go up.
DBM stores key => value pairs, the value has to be a scalar so:
won't work. there's a MLDBM module that will help you accomplish the second, or you can use Data::Dumper or YAML or FreezeThaw to convert your data structure into a string (that you store in the DBM, fetch later and unpack before using).
so a DBM is a simple key => value store that you can search/fetch by the key only. a RDBMS/SQL/Real Database is a lot like a DBM with multiple values, and every value can be a key. the data is arranged in tuples (think ARRAY) but they're regular and have names for each position so you can think of them as HASHes. there are multiple tuples per table and multiple tables per database and multiple databases per server ...
now you query with SQL which is almost understandable...
you would likely get that second bit back in perl as something like:
if the DBM provides enough funcionality for your purpose use it. if not install a simple SQL database like SQLite and work through the examples. then go an read some of the fine tutorials and/or books people are sure to mention.