On Mon, 11 Dec 2006 06:02:25 -0800, Rinku Mahesh wrote:
> -----------------
>   my @fields =();
>   my @unique_elements=();
>   my %seen   = ();
>    
>    
>       foreach my $elem (@fields) {
>       next if $seen{ $elem }++;
>       push (@unique_elements, $elem);
>     }
> -----------------
>    
>   What needs to be done to compute the count of skipped/duplicate elements ?

print "$_ seen $seen{$_} times\n" for grep { $seen{$_} > 1 } keys %seen;

-- 
Peter Scott
http://www.perlmedic.com/
http://www.perldebugged.com/


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