#!/usr/bin/perl %numbers; print "MENU\n 1. Add a name and telephone number.\n 2. Retrieve a telephone number\n 3. List all of the names and telephone numbers in the file\n 4. Quit the menu\n"; $decision = 0; while ($decision != 4) { $decision = <STDIN>; if ($decision == 1) { print "Enter name:"; $name = <STDIN>; print "Enter phone number:"; $phone = <STDIN>; $numbers{"$name"} = "$phone"; print "MENU\n 1. Add a name and telephone number.\n 2. Retrieve a telephone number\n 3. List all of the names and telephone numbers in the file\n 4. Quit the menu\n"; } if ($decision == 2) { print "Enter the name that you would like to look up\n"; $lookup = <STDIN>; chomp $lookup; @hashKeys = keys( %numbers ); @hashValues = values( %numbers ); print "The number for $loopup is $numbers{$lookup}\n"; #print "$hashKeys[$loopup]$hashValues[$lookup] \n"; #$seq = $numbers{$lookup}; #if (defined($seq)) { # print "The number is $seq\n"; #} #else { # print "Sorry, I don't know about \"$lookup\""; #} print "MENU\n 1. Add a name and telephone number.\n 2. Retrieve a telephone number\n 3. List all of the names and telephone numbers in the file\n 4. Quit the menu\n"; } if ($decision == 3) { print "These are the currently stored names and numbers:\n"; @hashKeys = keys( %numbers ); @hashValues = values( %numbers ); for ($i = 0; $i < @hashKeys; ++$i) { print "$hashKeys[$i]$hashValues[$i] \n"; } print "MENU\n 1. Add a name and telephone number.\n 2. Retrieve a telephone number\n 3. List all of the names and telephone numbers in the file\n 4. Quit the menu\n"; } }

Any help would be greatly appreciated. Thank you!