http://www.perlmonks.org?node_id=354592


in reply to Grepping on array

Howdy!

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.

yours,
Michael