#!/usr/bin/perl use strict; use Fcntl; use NDBM_File; my %simple_hash = { "a" => 1 , "b" => 2 }; tie(%simple_hash,"NDBM_File","samplefile.dbmx",O_RDWR|O_CREAT, 0666) or die ("Cannot tie the dbm file"); untie(%simple_hash); $simple_hash{"hi"} = "this works"; tie(%simple_hash,"NDBM_File","samplefile.dbmx",O_RDWR|O_CREAT, 0666) or die ("Cannot tie the dbm file"); untie(%simple_hash); my %new_hash; tie(%new_hash,"NDBM_File","samplefile.dbmx",O_RDWR|O_CREAT, 0666) or die ("Cannot tie the dbm file"); foreach my $keys (%new_hash) { print "$new_hash{$keys}\n"; } untie(%new_hash);