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


in reply to most efficient way to implement "A without B"

It might be worthwhile to take a look at the List:: modules on CPAN, specifically List::Util and List::Compare. List::Util provides functions like min, max, and sum. List::Compare provides intersection, union, and (of relevance to the posted question) ways to determine which elements appear in one list but not the other.

Zaxo provided a very nice (and probably more efficient) solution, but the List:: modules will come in handy if you have to do more complicated functions.

HTH

  • Comment on Re: most efficient way to implement "A without B"