Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Confusing syntax error with grep

by rsteinke (Scribe)
on Aug 12, 2004 at 14:06 UTC ( [id://382247]=note: print w/replies, xml ) Need Help??


in reply to Confusing syntax error with grep

I believe 'and' actually has a lower operator precedence than the comma operator, so your first expression is parsing as

( expression ) and ( expression ) and ( expression, @files )
Try replacing 'and' with '&&' and see if that helps.

Ron Steinke
<rsteinke@w-link.net>

Replies are listed 'Best First'.
Re^2: Confusing syntax error with grep
by ikegami (Patriarch) on Aug 12, 2004 at 15:36 UTC

    No, that would only be the case if the (last set of) parens weren't there.

      Nope he is correct, it was a problem with 'and' having lower precedence than ','

      grep ( ( expression) and ( expression) and ( expression ) , @files )

      Is interpreted as

      grep ( ( expression) and ( expression) and ( ( expression ) , @files ) + )

      According to perldoc -f grep, the construct grep( expression, list ) is allowed. But it is indeed confusing to man and machine!.

      Have Fun

        The post to which I replied said ... and ( expression , @files ), not ... and ( expression ) , @files as you used, so my reply *does* apply to the post to which I replied.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (5)
As of 2024-04-24 03:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found