my @data; my %seen; for (@input) { next if $seen{$_}++; push @data,$_; }
using grep, that would be:
update: s/make/mark/my %seen; my @data = grep { ! $seen{$_}++ } @input;
In reply to Re: Insert unique data into array
by Joost
in thread Insert unique data into array
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |