Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: saving matching pattern with flip-flop operator

by wfsp (Abbot)
on Jun 23, 2011 at 10:35 UTC ( #911045=note: print w/ replies, xml ) Need Help??


in reply to saving matching pattern with flip-flop operator

The second regex clears the capture from the first.

while (<DATA>) { if(/START/.../END TIME (.+)/) { my $time = $1; next if(/START/ | /^\s*$/); print $time, qq{\n}; } } __DATA__ START END TIME 123 START END TIME 456
123 456


Comment on Re: saving matching pattern with flip-flop operator
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (10)
As of 2015-07-06 16:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (77 votes), past polls