programming-examples/perl/Database/Writing Portable DBM Programs with the AnyDBM Module.pl
2019-11-15 12:59:38 +01:00

17 lines
374 B
Perl

#!/usr/bin/perl
use strict;
use warnings;
use AnyDBM_File;
use POSIX;
my %dbm;
my $db_file="anydbmdemo.dbm";
tie (%dbm, 'AnyDBM_File', $db_file, O_CREAT|O_RDWR, 0644);
unless (tied %dbm) {
print "Error opening $db_file $!\n";
} else {
$dbm{'Created'}=localtime;
foreach (sort keys %dbm) {
print "$_ => $dbm{$_}\n";
}
untie %dbm;
}