in reply to Looking Backward While counting

Like this?

#! perl -slw use strict; my( $first, $nFirst, $last, $nLast ); while( <DATA> ) { if( /##Flag##/ ) { ( $first ) = <DATA> =~ m[T:\s*(\d+)]; $nFirst = $.; } elsif( /##CloseFlag##/ ) { printf "%d lines diff: %d\n", $nLast - $nFirst +1, $last - $fi +rst; } ( $last ) = m[T:\s*(\d+)]; $nLast = $.; } =output c:\test>junk70 3 lines diff: -80508 4 lines diff: -556 =cut __DATA__ ##Flag## some T:89898 data T:3434 here T: 9390 ##CloseFlag## some data ##Flag## some T:898 data T:34 here T: 990 again T:342 ##CloseFlag##

Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
RIP an inspiration; A true Folk's Guy