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
In reply to Re: Line(s) extraction
by BrowserUk
in thread Line(s) extraction
by paurus
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |