第一次写了一个有点复杂的练习
my @a = qw(1 2 3 4 5);
my @b = qw(2 3 4 5 6);
my @c = qw(3 5 6 7);
my @std = qw(2 3 4 5);
my %all = (a => \@a, b => \@b, c => \@c);
check_items_for_all(\%all);
sub check_items_for_all {
$hashref = $_[0];
foreach (keys %$hashref) {
$arrayref = ${$hashref}{$_};
for my $item(@std) {
unless (grep $item eq $_,@$arrayref) {
print "$_ is missing item\n";
}
}
}
}
阅读(879) | 评论(0) | 转发(0) |