programming-examples/perl/Database/Deleting Entries from a DBM File.pl
2019-11-15 12:59:38 +01:00

14 lines
371 B
Perl

#!/bin/perl
use AnyDBM_File;
dbmopen(%states, "statedb", 0666) || die;
TRY: {
print "state abbreviation to remove. ";
chomp($abbrev=<STDIN>);
$abbrev = uc $abbrev;
delete $states{"$abbrev"};
print "$abbrev removed.\n";
print "Another entry? ";
$answer = <STDIN>;
redo TRY if $answer =~ /Y|y/;
}
dbmclose(%states);