tiehash#

Open an SDBM database and return a blessed handle. Invoked by Perl when the user writes tie %h, 'SDBM_File', $basename, $flags, $mode.

The five-argument form opens $basename.dir and $basename.pag using sdbm_open. The six-argument form (tie %h, 'SDBM_File', $dirfile, $flags, $mode, $pagfile) names the two files independently and uses sdbm_prep — useful with File::Temp handles.

$flags takes the usual Fcntl constants: O_RDONLY, O_WRONLY, O_RDWR, optionally OR’d with O_CREAT to create a missing database. $mode is the permission bits applied (after umask) to newly created files; 0666 is the usual choice.

Returns a blessed SDBM_File reference on success, or undef if the underlying open fails (with $! set to the reason).