You put $var into %seen with $seen{$var}++ and whenever it's already set you'll know it needs to be checked.
I'm not sure though how you want the first line to be handled, and you didn't provide test data.
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
In reply to Re: How to check lines that start with the same word then delete one of them
by LanX
in thread How to check lines that start with the same word then delete one of them
by agnes00
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |