第1个回答 2017-05-10
my %m = ('a', 'b', 'c', 'd');
my %n = ('a', 'b', 'c', 'd');
my %h = ('a', 'b', 'e', 'd');
my %k = ('a', 'b', 'e', 'd');
print same(\%m, \%n), "\n";
print same(\%h, \%k), "\n";
print same(\%m, \%k), "\n";
sub same{
my ($m, $n) = @_;
return 0 if ((keys %$m)!= (keys %$n));
for my $k(keys %$m) {
return 0 if (!exists $n->{$k});
}
return 1;
}本回答被网友采纳