in reply to How Do I Compare Array A to Array B, removing B elements from A.

It might be more efficient (depending on the sizes of the 2 arrays) to make a hash from one to do a quick lookup:

my %HashB = map { ($_ => 1) } @ArrayB; @ArrayA = grep { $HashB{$_} } @ArrayA;

-ben

Originally posted as a Categorized Answer.

  • Comment on Re: How Do I Compare Array A to Array B, removing B elements from A.
  • Download Code