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

Re^2: Variable assignment after logical OR

by jwkrahn (Abbot)
on Oct 02, 2007 at 20:03 UTC ( [id://642229]=note: print w/replies, xml ) Need Help??


in reply to Re: Variable assignment after logical OR
in thread Variable assignment after logical OR

In your open statement, || is evaluated before the comma, so your statement is parsed as open FILE, (">test.txt" || $failed_flag = 1); giving the syntax error.

Actually the  || operator also has higher precedence than the  = operator so it is parsed as open FILE, (">test.txt" || $failed_flag) = 1; which is why you get the error  Can't modify constant item in scalar assignment

Replies are listed 'Best First'.
Re^3: Variable assignment after logical OR
by FunkyMonk (Chancellor) on Oct 02, 2007 at 20:40 UTC
    You're absolutely right of course and I should have noticed that. Thanks for pointing it out.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (3)
As of 2024-04-20 12:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found