#!/usr/bin/perl -w
######################################################################
# sdbm.pl
######################################################################
# Perl Power! - Michael Schilli 1998
######################################################################

use SDBM_File;
use Fcntl;                    # definition of O_RDWR, O_CREAT etc.

$filename = "myhash";

                              # open persistent hash
tie(%myhash, SDBM_File, $filename, O_RDWR|O_CREAT, 0644) ||
     die "Cannot open $filename";

                              # initialization, if yet
                              # undefined
$myhash{"key"} = 0 unless defined($myhash{"key"});

                              # output value
print "myhash{key} = $myhash{key}\n";


$myhash{"key"}++;             # set new value

untie %myhash;                # release hash

