Copyright © tutorialspoint.com

PERL dbmclose Function


Syntax

dbmclose HASH


Definition and Usage

Closes the binding between a hash and a DBM file. Use the tie function with a suitable module.

Return Value

  • 0 on failure

  • 1 on success

Note that functions such as keys and values may return huge lists when used on large DBM files. You may prefer to use the each function to iterate over large DBM files. Example:

#!/usr/bin/perl

# print out history file offsets
dbmopen(%HIST,'/usr/lib/news/history',0666);
while (($key,$val) = each %HIST) {
   print $key, ' = ', unpack('L',$val), "\n";
}
dbmclose(%HIST);


Copyright © tutorialspoint.com