Though about using a hash but I don't have a need for a Key/Value
combination. I just need a list without duplicates. I suppose I can define
the hash keys if they don't already exists and export the keys into an array
with the keys function. Is that what you are hinting towards?

Thanks,
Brian

-----Original Message-----
From: Bob Showalter [mailto:[EMAIL PROTECTED]
Sent: Friday, October 29, 2004 2:56 PM
To: '[EMAIL PROTECTED]'; [EMAIL PROTECTED]
Subject: RE: easy way to add element to array


[EMAIL PROTECTED] wrote:
> Hi. I'm working with an array that i'm pushing values on to, but I
> don't want there to be any duplicates. Is there a perl function of an
> easy way to check if an array already contains a value before I push
> that value on to it?

First consider whether you should be using a hash.

If you still want to use an array, the Tie::File::Array module will do the
trick.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to