in reply to removing duplicated elements from array, with a difference

A two-pass process. First, count number of entries for each elem:
my %item_count; %item_count{$_}++ foreach (@array);
Next, remove any element whose item_count != 1:
@result = grep {$item_count{$_} == 1} @array;
--Dave.

Update: for the duplicate sub-pattern problem:

my %item_count; %item_count{$_}++ for grep {/pattern/} @array @result = grep {$item_count{$_} <= 1} @array;

Update 2: to avoid the uninitialized value warning:

@result = grep {($item_count{$_}||0) <= 1} @array;