我有以下代码。isSubset
没有附加的 CPAN 模块可以写得更简单吗?
my @possibleNames = ("adam", "chelsea");
my @actualNames = ("adam", "chucky", "chelsea");
sub isSubset {
my ($littleSet, $bigSet) = @_;
foreach (@{$littleSet}) {
return 0 unless ($_ ~~ @{$bigSet});
}
return 1;
}
printf("%s\n", (isSubset(\@possibleNames, \@actualNames) ? "yes" : "no"));