http://qs321.pair.com?node_id=11115311


in reply to How to check lines that start with the same word then delete one of them

Yes just one loop and a %seen hash.

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