You are viewing the version of this documentation from Perl 5.30.0. View the latest version



GDBM_File - Perl5 access to the gdbm library.


use GDBM_File ;
tie %hash, 'GDBM_File', $filename, &GDBM_WRCREAT, 0640;
# Use the %hash array.
untie %hash ;


GDBM_File is a module which allows Perl programs to make use of the facilities provided by the GNU gdbm library. If you intend to use this module you should really have a copy of the gdbm manualpage at hand.

Most of the libgdbm.a functions are available through the GDBM_File interface.

Unlike Perl's built-in hashes, it is not safe to delete the current item from a GDBM_File tied hash while iterating over it with each. This is a limitation of the gdbm library.


gdbm is available from any GNU archive. The master site is, but you are strongly urged to use one of the many mirrors. You can obtain a list of mirror sites from


Do not accept GDBM files from untrusted sources.

GDBM files are not portable across platforms.

The GDBM documentation doesn't imply that files from untrusted sources can be safely used with libgdbm.

A maliciously crafted file might cause perl to crash or even expose a security vulnerability.


The available functions and the gdbm/perl interface need to be documented.

The GDBM error number and error message interface needs to be added.


perl(1), DB_File(3), perldbmfilter.