in reply to Re: Order of operations
in thread Order of operations
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Order of operations
by Marshall (Canon) on Nov 16, 2017 at 09:48 UTC | |
by haukex (Archbishop) on Nov 16, 2017 at 11:49 UTC |