A more canonical (and efficient) way of preserving order, whether the input data is sorted or not, would be along the lines of:
my %seen; while ( <DATA> ) { s/\s+$//; # Remove trailing spaces and newline. print "$_\n" unless $seen{$_}++; }
By the way, why do you use our instead of my?
In reply to Re^2: removing duplicate lines
by Not_a_Number
in thread removing duplicate lines
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |