Andrew Rosolino wrote:

> Say I have an array that contains!
> 
> @array = qw( cool cool dog dog dog );
> 
> Now I want to sum that up, so that the array only has
> 1 COOL and 1 DOG, so it would contain!
> 
> @array = qw( cool dog );


my %array;

map { $array{$_}++ } @array;

my @unique = keys %array;

there are several examples in the perl cookbook that demonstrate other 
methods for finding unions, intersections, etc.


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

Reply via email to