1 #!/usr/bin/perl -w 2 3 use strict; 4 5 my %course = ( 6 2 => 'c', 7 1 => 'unix', 8 3 => 'shell', 9 4 => 'perl', 10 ); 11 12 while ( (my $key, my $value) = each(%course) ) { 13 print "$key => $value\n"; 14 } 15 16 print "\nSorted values of hash:\n"; 17 foreach my $val (sort values %course){ 18 print "$val\n"; 19 } 20 print "\nEnter Key: "; 21 my $type = ; 22 print "you will be taking $course{$type} this semester\n"; #### :~/pbe/chap5$ ./exer5.pl 4 => perl 1 => unix 3 => shell 2 => c Sorted values of hash: c perl shell unix Enter Key: 2 Use of uninitialized value within %course in concatenation (.) or string at ./exer5.pl line 22, line 1. you will be taking this semester