in reply to Array Comparison
To duplicate your code functionally, we have to:
We pre-load %seen with a flag for each word in @exclude. Then, as we're looking through @words itself, we mark each element as seen as well.# given @words and @exclude my %seen; @seen{@exclude} = (1) x @exclude; @words = grep { (! /\W/) and (length() >= 4) and ($seen{$_}++ == 0) } @words;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Array Comparison
by mcogan1966 (Monk) on Dec 22, 2003 at 19:16 UTC |