Beefy Boxes and Bandwidth Generously Provided by pair Networks Frank
Do you know where your variables are?
 
PerlMonks  

Re: Re: print line 5 lines previous to comaprison line!

by Adam (Vicar)
on Jun 07, 2001 at 21:47 UTC ( [id://86772]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to Re: print line 5 lines previous to comaprison line!
in thread print line 5 lines previous to comaprison line!

Nice. One suggestion:
# change: print $buffer[0] if /$pat/; # to: print $buffer[0] if /\Q$pat\E/o;
The \Q and \E presume that $pat is just a string, not a regex. So you would want to escape any special characters (like '.' or '+' ) and the o tells Perl that $pat isn't going to change in the loop, so it won't keep recompiling the pattern.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://86772]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.