Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

Re^3: Multiline match

by kennethk (Abbot)
on May 23, 2013 at 16:33 UTC ( #1034978=note: print w/ replies, xml ) Need Help??

in reply to Re^2: Multiline match
in thread Multiline match

hdb's point was your code boils down to 'patch-' =~ /patch-;, which is backwards from what you need. The behavior you seek would look more like

my @array = split('\n',$output); if ( grep { 'patch-' =~ /\Q$_\E/ } @array ) { print "Match found\n"; }
Though, as implemented, you'd have problems because of whitespace. For this case, you'd probably be better off using index.

#11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.

Comment on Re^3: Multiline match
Select or Download Code
Replies are listed 'Best First'.
Re^4: Multiline match
by hdb (Prior) on May 23, 2013 at 16:39 UTC


Log In?

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (9)
As of 2015-10-07 20:30 GMT
Find Nodes?
    Voting Booth?

    Does Humor Belong in Programming?

    Results (200 votes), past polls