>    (not ($label.$inst) =~ /\blea\b/i)

Parens break precedence!

In this case Perl sees an opening bracket for the operand of the not operator.

Updates

(emphasis added)

See perlop#Terms-and-List-Operators-(Leftward)

"A TERM has the highest precedence in Perl. They include variables, quote and quote-like operators, any expression in parentheses, and any function whose arguments are parenthesized. Actually, there aren't really functions in this sense, just list operators and unary operators behaving as functions because you put parentheses around the arguments. These are all documented in perlfunc"

see also perlfunc

"Any function in the list below may be used either with or without parentheses around its arguments. (The syntax descriptions omit the parentheses.) If you use parentheses, the simple but occasionally surprising rule is this: It looks like a function, therefore it is a function, and precedence doesn't matter. Otherwise it's a list operator or unary operator, and precedence does matter."

FWIW

If you're confused what Perl is parsing, using B::Deparse can come in handy.

$ perl -MO=Deparse -e' (not ($label.$inst) =~ /\blea\b/i)' !($label . $inst) =~ /\blea\b/i; -e syntax OK ~ $ ~ $ perl -MO=Deparse,-p -e' (not ($label.$inst) =~ /\blea\b/i)' ((!($label . $inst)) =~ /\blea\b/i); -e syntax OK ~ $

Cheers Rolf
(addicted to the Perl Programming Language :)
see Wikisyntax for the Monastery


In reply to Re: Why does NOT operator on match operator on string concatenation require two pairs of parens? by LanX
in thread Why does NOT operator on match operator on string concatenation require two pairs of parens? by ecm

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.