Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
Re^3: get n lines before or after a patternby Kenosis (Priest) |
on Jul 26, 2012 at 03:41 UTC ( [id://983763]=note: print w/replies, xml ) | Need Help?? |
This is of interest, and excellent, too, JohnGG! I was aware that I didn't confine the local $/; to a block, not thinking too much about the code snippet. However, I'll remember--as a best practice--to do so with future local (dynamically scoped) variables. It was good to point this out. I like your refined/seasoned coding: scoping, reading in a multi-line record, opening a file handle on the record-containing scalar, and then grepping through the lines to display the OP's desired output. Indeed, this is of interest, very well thought out, and very much appreciated. Thank you.
In Section
Seekers of Perl Wisdom
|
|