Tutorials Point

Google
Web This Site

  Perl Home

  PERL Functions

© 2006 TutorialsPoint.COM


  Home     References     About TP     Advertising  

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);



Printer Friendly



  

Advertisement