programming-examples/perl/Database/Create, add, delete, and close a DBM file and how to create a Perl-style report.pl

18 lines
421 B
Perl
Raw Normal View History

2019-11-15 12:59:38 +01:00
#!/usr/bin/perl
use AnyDBM_File;
dbmopen(%states, "statedb", 0666[a]) || die;
TRY: {
print "State Abbreviation:";
chomp($abbrev=<STDIN>);
$abbrev = uc $abbrev;
print "Name of the state:";
chomp($state=<STDIN>);
lc $state;
$states{$abbrev}="\u$state";
print "Another entry? ";
$answer = <STDIN>;
redo TRY if $answer =~ /Y|y/;
}
dbmclose(%states);