That nested loop is the killer. How about a hash? The following code is untested and unoptimized but performs better algorithmically:
my %exclude; @exclude{ @exclude } = (); my @cleaned = grep { exists $exclude{ $_ } ? () : $_ } @words;
Update: Yep, I confused grep with map in my pre-breakfast haste. That should rather be:
my @cleaned = grep { ! exists $exclude{ $_ } } @words;In reply to Re: Array Comparison
by chromatic
in thread Array Comparison
by mcogan1966
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |