zjzc01:/root/big# cat grades
A 70
B 80
C 90
D 50
E 60
F 80
zjzc01:/root/big# cat a7.pl
open(GRADES, "grades") or die "Can't open grades: $!
";
while ($line = <GRADES>) {
($student, $grade) = split(" ", $line);
$grades{$student} = $grade ;
};
print "\%grades is :
";
print %grades;
print "
";
print "$grades{A} is $grades{A}
";
print "
";
print "$grades{B} is $grades{B}
";
zjzc01:/root/big# perl a7.pl
%grades is :
F80A70D50C90E60B80
$grades{A} is 70
$grades{B} is 80