I assume you just want to "collapse" consecutive lines and you don't care about "repetitions" which are separated.
Hence no %seen hash is needed, just remember the $last line aka array and compare it to the $current one.
If the $current one fits your criteria add it to $last, if it doesn't print $last and make $last=$current for the next iteration.
Cheers Rolf
(addicted to the Perl Programming Language :)
see Wikisyntax for the Monastery
In reply to Re: Summing up duplicate lines
by LanX
in thread Summing up duplicate lines
by oko1
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |