The Perl print statement allows an optional file handle right after "print" ... This makes it clear that the first arg is not a file handle.
Sorry but that's not the reason print gets confused, it's the parens. The optional file handle is independent of those:
$ perl -wMstrict -le 'print ( STDOUT "42") + 1' print (...) interpreted as function at -e line 1. Useless use of addition (+) in void context at -e line 1. 42 $ perl -wMstrict -le 'print ({*STDOUT} "42") + 1' print (...) interpreted as function at -e line 1. Useless use of addition (+) in void context at -e line 1. 42
In reply to Re^2: Order of operations
by haukex
in thread Order of operations
by hchana
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |