1 2 3 4 5 6
my $last, $incs; while (<>) { $incs++ if ($last && $_ > $last); $last = $_; } print "$incs\n";