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
In reply to Re^2: Variable assignment after logical OR
by jwkrahn
in thread Variable assignment after logical OR
by rq-2102
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |