my %count; my @deduped = grep { $count{$_} == 1 } map { $count{$_} ++; $_ } @data;