Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re^3: get n lines before or after a pattern

by Kenosis (Priest)
on Jul 26, 2012 at 03:41 UTC ( [id://983763]=note: print w/replies, xml ) Need Help??


in reply to Re^2: get n lines before or after a pattern
in thread get n lines before or after a pattern

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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://983763]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (4)
As of 2024-04-23 20:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found