# Build the hash of NASA missions: %hash=(ACE=>'08/25/97', ASCA=>'02/20/93', FAST=>'08/21/96'); # Really, there could be a LOT more! # Prompt for and chomp keyboard input: print "Enter mission code (or ALL): "; chomp($code=); # Force input to uppercase. $code=~tr/a-z/A-Z/; # Action to print all data: if ($code eq 'ALL') { foreach $code (sort(keys(%hash))) { printf "%6s was launched on %8s.\n", $code, $hash{$code}; } exit; } # Action to print selected data: if (defined($hash{$code})){ printf "%6s was launched on %8s.\n", $code, $hash{$code};} else { print "$code not found.\n";}