Copying from One DBM Format to Another : DBM « Database « Perl






Copying from One DBM Format to Another

   

#!/usr/bin/perl

use warnings;
use strict;
use POSIX;
use NDBM_File;
use GDBM_File;
my (%ndbm_db,%gdbm_db);
my $ndbm_file='/tmp/my_old_ndbm_database';
my $gdbm_file='/tmp/my_new_gdbm_database';
tie %ndbm_db, 'NDBM_File',$ndbm_file, O_RDONLY, 0;
tie %gdbm_db, 'GDBM_File',$gdbm_file, O_CREAT|O_WRONLY, 0644;
%gdbm_db=%ndbm_db;
untie %ndbm_db;
untie %gdbm_db;

   
    
    
  








Related examples in the same category

1.Creating and Assigning Data to a DBM File
2.Open DBM up for read write access
3.Opening an MLDBM database is similar to opening a regular DBM database:
4.Reads DBM file, printing entries with tie and untie function
5.Store hashes in a DBM file:
6.Using DBM databases with reports
7.Write out data into a DBM database