- dbmopen HASH,DBNAME,MASK
[This function has been largely superseded by the
This binds a dbm(3), ndbm(3), sdbm(3), gdbm(3), or Berkeley DB file to a hash. HASH is the name of the hash. (Unlike normal
open, the first argument is not a filehandle, even though it looks like one). DBNAME is the name of the database (without the .dir or .pag extension if any). If the database does not exist, it is created with protection specified by MASK (as modified by the
umask). If your system supports only the older DBM functions, you may perform only one
dbmopenin your program. In older versions of Perl, if your system had neither DBM nor ndbm, calling
dbmopenproduced a fatal error; it now falls back to sdbm(3).
If you don't have write access to the DBM file, you can only read hash variables, not set them. If you want to test whether you can write, either use file tests or try setting a dummy hash entry inside an
eval, which will trap the error.
You can control which DBM library you use by loading that library before you call dbmopen():