use strict; use List::MoreUtils(qw/uniq/); my @uniques = uniq(<DATA>); print @uniques; __DATA__ Name1 Name2 Name2 Name3 Name3 Name3 Name3 Name4 Name4
Output:
Name1 Name2 Name3 Name4
The initial list does not have to be sorted (as with the UNIX uniq) and the order is preserved.
CountZero
"If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law
In reply to Re: removing duplicate lines
by CountZero
in thread removing duplicate lines
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |