Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
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 ( #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
Node Status?
node history
Node Type: note [id://1162444]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (2)
As of 2021-02-27 04:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?