in reply to Re^2: Global substitution and report
in thread Global substitution and report
One possibility is to step through substrings of the file content, starting at each new line. Here is a sketch:
Annomy $content = do { local $/; <DATA> }; my ( $ln, $start) = ( 1, 0); while ( $start < length $content ) { if ( substr( $content, $start) =~ s/.../.../ ) { print "line $ln changed\n"; } $start = 1 + index( $content, "\n", $start); ++ $ln; } __DATA__ aaa bbb ccc ddd eee
|
---|