gdbm_fetch

This returns the value that is associated with the key from the gdbm file.

gdbm_fetch name key ?retvar | {}?
  • name is the name of a gdbm database previously opened with gdbm_open.
  • If you do not specify retvar, then the value is returned as the result of the command. In this case, if key is not found in the list, then an error results.
  • If you do specify retvar and key is in the file, then the value is returned in the variable retvar and the command returns 1. If key is not in the file, then the command returns 0, and retvar is left unchanged.
  • If you specify {} for retvar, then the value is not returned. When this is finished, you can determine if a key is present in a gdbm file without setting a variable as a side effect.