15 lines
340 B
Perl
15 lines
340 B
Perl
|
#!/usr/bin/perl
|
||
|
use warnings;
|
||
|
use strict;
|
||
|
use POSIX;
|
||
|
|
||
|
use SDBM_File;
|
||
|
use Storable;
|
||
|
my %dbm;
|
||
|
my $db_file="demo.dbm";
|
||
|
tie %dbm, 'SDBM_File', $db_file, O_CREAT|O_RDWR, 0644;
|
||
|
|
||
|
$dbm{'key'}=Storable::freeze({Name=>"John", Value=>"Smith", Age=>"42"});
|
||
|
|
||
|
my $href=Storable::thaw($dbm{'key'});
|
||
|
my %hash=%{ Storable::thaw($dbm{'key'}) };
|