If you mean, "How can I display an array of the
unique elements of an array that contains some
repeated elements", this may serve your purpose:
my @ary = qw(a b c d d e b d);
my %hsh;
undef @hsh{@ary};
my @ary2 = keys %hsh;
print "@ary2\n";
The key here
is:
undef @hsh{@ary};
which is a
hash slice. The hash slice is an lvalue (that
is, it is assignable).
The undef is associative for each
element of the slice. The effect of this
is to establish a
key in the hash corresponding to
each array element. Except that duplicate keys
just write over each other. Each key has a
corresponding
value of
undef. Then, on the next
line we just extract the (now unique) keys
into a new array.