in reply to Line(s) extraction
Rather than bothering with $., why not just print the line containing the regex and then 3 more lines?
#! perl -sw use strict; while( <DATA> ) { next unless m[two]; print; print scalar <DATA> for 1..3; } __DATA__ one two three four five six
|
|---|