Come for the quick hacks, stay for the epiphanies. | |
PerlMonks |
Re: Array Comparisonby chromatic (Archbishop) |
on Dec 22, 2003 at 18:32 UTC ( [id://316438]=note: print w/replies, xml ) | Need Help?? |
That nested loop is the killer. How about a hash? The following code is untested and unoptimized but performs better algorithmically:
Update: Yep, I confused grep with map in my pre-breakfast haste. That should rather be: my @cleaned = grep { ! exists $exclude{ $_ } } @words;
In Section
Seekers of Perl Wisdom
|
|