Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

Re: Multiline match

by hdb (Prior)
on May 23, 2013 at 16:22 UTC ( #1034975=note: print w/replies, xml ) Need Help??

in reply to Multiline match

Whatever you are trying: "patch-" will not match to your $output because of the ".gpg" extension...

Replies are listed 'Best First'.
Re^2: Multiline match
by arunbhargav (Novice) on May 23, 2013 at 16:27 UTC
    patch- is a substring of patch-, hence it should match. All it wants to match is patch-, it doesnt care about gpg

      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.


      But your explanation was the other way round.

      plz try to show us a reproducible code example instead of wording.

      Cheers Rolf

      ( addicted to the Perl Programming Language)

        Sorry about the confusion, the following is the code I have been trying
        my $str = "update patch-"; my $patch = "patch-"; if ($str =~/$patch/ms) { print "Yes \n"; }

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (4)
As of 2016-10-26 05:55 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (336 votes). Check out past polls.