in reply to Removal of duplicated element in array.
my @match_to_array = (a,b,c,a,d,c,b,r); my %seen = (); my @r = (); foreach my $a (@match_to_array) { unless ($seen{$a}) { push @r, $a; $seen{$a}++; } } print "@r"; print "\n@match_to_array";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Removal of duplicated element in array.
by 2teez (Vicar) on May 06, 2013 at 14:36 UTC | |
|
Re^2: Removal of duplicated element in array.
by tty1x (Novice) on May 06, 2013 at 14:16 UTC |