Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: search a string and get the output that belongs to the string

by graff (Chancellor)
on May 07, 2016 at 20:17 UTC ( [id://1162444]=note: print w/replies, xml ) Need Help??


in reply to search a string and get the output that belongs to the string

Here's another way (very similar to the first reply, but a little simpler):
#!/usr/bin/env perl use strict; use warnings; my @message; while (<DATA>) { push @message, $_; if ( /quarantine/ ) { # this is the last expected line of each me +ssage local $_ = join( "", @message ); local $\ = "\n"; print if ( /<jay@/i ); @message = (); } }

Log In?
Username:
Password:

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

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

    No recent polls found