in reply to Re^2: print a determinate line number
in thread print a determinate line number
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: print a determinate line number
by Paulux (Acolyte) on Oct 06, 2009 at 13:53 UTC |