On Oct 29, Bob Showalter said:

>[EMAIL PROTECTED] wrote:
>> 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?
>
>Yes, that's what I'm hinting at :~)
>
>A hash would be called for if you need to do repeated tests to see whether
>an element exists in the set. The downside to pulling the unique values with
>keys() is that you lose the original order, if that matters.
>
>Tie::Array::Unique will take care of the problem and preserve the order,
>while letting you push entries onto the array without worrying about
>creating duplicates.

Thank you for the plug. :)

Tie::Array::Unique is a transparent solution -- that is, all you do is
tie the array to T::A::U and things get done.  Using hashes isn't all that
hard, but T::A::U does that for you.

-- 
Jeff "japhy" Pinyan         %  How can we ever be the sold short or
RPI Acacia Brother #734     %  the cheated, we who for every service
http://japhy.perlmonk.org/  %  have long ago been overpaid?
http://www.perlmonks.org/   %    -- Meister Eckhart


-- 
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