# File: dbmSearch.pl # Title: Data Base Management # Author: Mihaela Malita # Read a data base and modify # try first: dbm0.pl (Create the database) dbmopen(%Studs,"dbm0",UNDEF); # permission mode 0644 # links (ties) %Studs to dbm0.pag - should be on the disk # reads students from the database: dbm0 print "my students are: ", %Studs ,"\n\n"; while (($key, $value) = each (%Studs)) { #reads data base dbm0 print "$key has $value \n"; } print "\nModify the databse and print it\n"; # add new student $Studs{"Greg"} = "Mendel"; # delete Jen delete $Studs{"Jen"}; # if it is not there does not do anything while (($key, $value) = each (%Studs)) { #reads data base dbm0 print "$key has $value \n"; } dbmclose(%Studs); #data base has been modified!! # all the info is in the dbm0.pag database same directory exit;