my $last = ""; while (<>) { print if $_ eq $last; $last = $_; }