标签: perl
在Perl中减去两个数组的惯用方法是什么?我不经常写Perl,我不明白为什么这不起作用:
my @arr1 = ("a", "b","c",); my @arr2 = ("a", "b","c", "d", "E"); my @rs; foreach my $e (@arr2) { if(grep(!/^$e$/, @arr1)) { # if $e is not in @arr1 push(@rs, $e); } }