=head1 SYNOPSIS
use GDBM_File ;
- tie %hash, GDBM_File, $filename, &GDBM_WRCREAT, 0640);
+ tie %hash, 'GDBM_File', $filename, &GDBM_WRCREAT, 0640);
# Use the %hash array.
untie %hash ;
use NDBM_File;
- tie(%h,NDBM_File,'Op.dbmx', O_RDWR|O_CREAT, 0640);
+ tie(%h, 'NDBM_File', 'Op.dbmx', O_RDWR|O_CREAT, 0640);
untie %h;
use ODBM_File;
- tie(%h,ODBM_File,'Op.dbmx', O_RDWR|O_CREAT, 0640);
+ tie(%h, 'ODBM_File', 'Op.dbmx', O_RDWR|O_CREAT, 0640);
untie %h;
use SDBM_File;
- tie(%h,SDBM_File,'Op.dbmx', O_RDWR|O_CREAT, 0640);
+ tie(%h, 'SDBM_File', 'Op.dbmx', O_RDWR|O_CREAT, 0640);
untie %h;
Having multiple DBM implementations makes it trivial to copy database formats:
use POSIX; use NDBM_File; use DB_File;
- tie %newhash, DB_File, $new_filename, O_CREAT|O_RDWR;
- tie %oldhash, NDBM_File, $old_filename, 1, 0;
+ tie %newhash, 'DB_File', $new_filename, O_CREAT|O_RDWR;
+ tie %oldhash, 'NDBM_File', $old_filename, 1, 0;
%newhash = %oldhash;
=head2 DBM Comparisons
package main;
- tie %new_hash, NewHash;
- tie %new_std_hash, NewStdHash;
+ tie %new_hash, 'NewHash';
+ tie %new_std_hash, 'NewStdHash';
=head1 DESCRIPTION
package main;
- tie $new_scalar, NewScalar;
- tie $new_std_scalar, NewStdScalar;
+ tie $new_scalar, 'NewScalar';
+ tie $new_std_scalar, 'NewStdScalar';
=head1 DESCRIPTION
require Tie::SubstrHash;
- tie %myhash, Tie::SubstrHash, $key_len, $value_len, $table_size;
+ tie %myhash, 'Tie::SubstrHash', $key_len, $value_len, $table_size;
=head1 DESCRIPTION
package main;
use Fcntl qw( O_RDWR O_CREAT );
- tie %foo, Mydbm, "Sdbm", O_RDWR|O_CREAT, 0640;
+ tie %foo, "Mydbm", "Sdbm", O_RDWR|O_CREAT, 0640;
$foo{'bar'} = 123;
print "foo-bar = $foo{'bar'}\n";
- tie %bar, Mydbm, "Sdbm2", O_RDWR|O_CREAT, 0640;
+ tie %bar, "Mydbm", "Sdbm2", O_RDWR|O_CREAT, 0640;
$bar{'Cathy'} = 456;
print "bar-Cathy = $bar{'Cathy'}\n";
package main;
use Fcntl qw( O_RDWR O_CREAT );
- tie %foo, Mydbm, "adbm", O_RDWR|O_CREAT, 0640;
+ tie %foo, "Mydbm", "adbm", O_RDWR|O_CREAT, 0640;
$foo{'bar'} = 123;
print "foo-bar = $foo{'bar'}\n";