What modules handle this? I have been digging around in CPAN all day... -- -- Jason Dusek ("`-''-/").___..--''"`-._ -- | `6_ 6 ) `-. ( ).`-.__.`) -- | (_Y_.)' ._ ) `._ `. ``-..-' -- | _..`--'_..-_/ /--'_.' ,' -- | (il),-'' (li),' ((!.-' --
James Edward Gray II wrote:
> On May 18, 2004, at 9:14 PM, Jason Dusek wrote:
>
>> Hi,
>>
>> Is there an easy way to get all the unique elements of an array? i.e. is there some module or function that does that sort of thing?
>
>
>
> There are excellent modules to handle this, but it's also pretty simple to roll your own in most cases:
>
> sub unique { # see title of this message for usage
> my @all = @_;
> my %seen;
> $seen{$_}++ foreach @all;
> return keys %seen;
> }
>
> Hope that helps.
>
> James
>
>
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>