my %first = map { $_ => 1 } @arr2; @result = grep !exists $first{$_}, @arr1;
%first is a hash whose keys are the distinct values in @arr2. The grep returns a list of the values in @arr1 that don't exist in %first, thus eliminating values in @arr2.
In reply to Re: Grepping on array
by herveus
in thread Grepping on array
by hotshot
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |