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);
> }
> -
>
Rinku Mahesh wrote:
> Hi,
Hello,
> I've an array storing some numbers , out of which few are duplicate.
> I'd like to skip those which are duplicate and save them in a new
> array and same time I wish to count the number of skipped/duplicate
> elements.
>
> Eg:-
>
> Given Array "fields" {12,12
Hi,
I've an array storing some numbers , out of which few are duplicate.
I'd like to skip those which are duplicate and save them in a new array and
same time I wish to count the number of skipped/duplicate elements.
Eg:-
Given Array "fields" {12,12,12,12,17,20,25,100,100,1