if the following line is different from the previous i have to print it
For that, you'd have to keep the previous line:
my $prev; while (<>) { print if defined($prev) and $_ ne $prev; $prev = $_; # update $prev }
(The defined check would skip the first line, as there isn't really one previous to it...)
In reply to Re^3: print a determinate line number
by almut
in thread print a determinate line number
by Paulux
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |