UPDATE:use strict; use warnings; my $previous_line; while(<DATA>){ chomp; if($.==1){ $previous_line = $_; next; } if($_ eq $previous_line){ print "Line $. : $_\n"; } $previous_line = $_; } __DATA__ a b b c c c d
Sorry the code above prints the duplicated lines, which is the opposite of what you wanted. i see that almut already has an elegant solution for you.
In reply to Re^3: print a determinate line number
by arun_kom
in thread print a determinate line number
by Paulux
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |