Here is my (loosely tested) version: #!perl use strict; use warnings; my $last_line = <DATA>; my $seen_count = 1; while (<DATA>) { if ( $last_line ne $_ ) { print $last_line if $seen_count == 1; $last_line = $_; $seen_count = 0; } $seen_count++; } print $last_line if $seen_count == 1; __END__ a1a a1a b1b c1c c1c d1d d1d e1e f1f g1g g1g h1h h1h i1i j1j
In reply to Re: Read file line by line and check equal lines
by Util
in thread Read file line by line and check equal lines
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |