我有两个名为的数组@these_conf_users
@these_account_users
,如下所示:
adrian bruce malcolm
brom testwp sajay bruce ast domainte adrian rahul freddy onetwo
目的是从第二个数组中删除元素,如果它们存在于第一个数组中。使用这个例子,这就是我所做的:
my %sorter;
@sorter{ @these_conf_users } = ();
@tester = grep ! exists $sorter{$_}, @these_account_users;
print "@these_conf_users";
print "@these_account_users";
print "@tester";
但这并不排除重复的元素。这是输出:
adrian bruce malcolm
brom testwp sajay bruce ast domainte adrian rahul freddy onetwo
brom testwp sajay bruce ast domainte adrian rahul freddy onetwo
我在这里错过了什么?