You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
718 B
Perl

#!/bin/perl
my $hashref = {
Math => { # key
"A" => 100,
"H" => 95, # values
},
Science => { # key
"S" => 78,
"L" => 100, # values
},
};
print "$hashref->{'Math'}->{'A'}.\n";
$hashref->{'Science'}->{'L'}=90;
print "$hashref->{'Science'}->{'L'}.\n";
print %{$hashref->{'Math'}}, "\n";
foreach $key (keys %{$hashref}){
print "Outer key: $key \n";
while(($nkey,$nvalue)=each(%{$hashref->{$key}})){
printf "\tInner key: %-5s -- Value: %-8s\n",$nkey,$nvalue;
}
}