in reply to best data structure

Why not combine the two approaches? The first solution which comes to my mind calls for a single iteration through the elements of @list with a lookup hash, %hash, that is used to avoid duplicate processing.

For example ...

my %hash; while (my $item = shift @list) { next if exists $hash{$item}++; . . }