#!/usr/bin/perl # FILE: print_staff_db # Prints the database, sorted by key, to the screen #Use the DBM module. use DB_File; my (%contents,$name, $record); $db_file = "staff.db"; # Open the DBM database file. tie (%contents, "DB_File", $db_file) || die "Could not open DBM file :$db_file $!\n"; $count = 0; # Start printing out the database information. for $number (sort keys %contents) { # Get the contents from the hash. $record = $contents{$number}; $count++; # Write it... print "$count $number $record \n"; } # Close the DBM database. untie %contents;