Here is one way:
use strict; use warnings; my @names = qw(Mary Mary Mary Mary Joe Joe Joe); my %unique; @unique{@names} = undef; @names = keys %unique; print join ", ", @names;
Prints:
Joe, MaryUpdate s/undef/()/ per Roy Johnson's reply
In reply to Re: removing duplicate entries from an array
by GrandFather
in thread removing duplicate entries from an array
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |