"Janek Schleicher" <[EMAIL PROTECTED]> writes:

> B. Fongo wrote at Mon, 30 Jun 2003 23:46:19 +0200:
> 
> > Is there any other way to check array uniqueness except the Module
> > Array::Unique?
> > I'm having problems in installing these two Modules: Array::Unique and
> > Tie.  So I'm thinking of another way to check array for replicates.
> > 
> > I help will be appreciate. Thanks a lot!
> 
> You can also hardcode it e.g.
> 
> {
>    my %seen;
>    if (grep {$seen{$_}} @array) {

The above line should be:

    if (grep {$seen{$_}++} @array) {

>       # at least one element is twice
>    } else {
>       # unique
>    }
> }


-RN

-- 
Robin Norwood
Red Hat, Inc.

"The Sage does nothing, yet nothing remains undone."
-Lao Tzu, Te Tao Ching

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to