here is a function to remove the duplicated elements
it treates the elements as strings
you can use this for numaric values after changing 'eq' to '=='
only problem of this code it significantly alter the order of the array
sub unique(@){
my(@source) = @_;
my @destination;
@source = sort(@source);
foreach (@source){
if (!($destination[$#destination] eq $_)){
$destination[++$#destination] = $_;
}
}
return @destination;
}
________________________________________
Rakhitha Karunarathne
Web Master
www.Ad-Man.tk - Free Unlimited Banner Rotators
________________________________________
----- Original Message -----
From: "Jason Dusek" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, May 19, 2004 8:14 AM
Subject: @UNIQUE=unique(@REDUNDANT);
> 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?
> --
> -- Jason Dusek ("`-''-/").___..--''"`-._
> -- | `6_ 6 ) `-. ( ).`-.__.`)
> -- | (_Y_.)' ._ ) `._ `. ``-..-'
> -- | _..`--'_..-_/ /--'_.' ,'
> -- | (il),-'' (li),' ((!.-'
> --
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> <http://learn.perl.org/> <http://learn.perl.org/first-response>
>
>
>
>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>