in reply to Insert unique data into array

The idiomatic way in perl is to use a hash to mark already inserted data:

my @data; my %seen; for (@input) { next if $seen{$_}++; push @data,$_; }

using grep, that would be:

my %seen; my @data = grep { ! $seen{$_}++ } @input;
update: s/make/mark/
update2: fixed bug, thanks to Happy-the-monk