in reply to Re^3: Operator precedence of unary plus (Bug or Feature)
in thread Operator precedence of unary plus (Bug or Feature)
I remember discussing here that "print FILEHANDLE" has a special magic different from normal "indirect object" syntax.
but the parsing of bar Foo +6; is not really as dangerous as print $x +6 is.
If Foo was a constant, any association to the package Foo would be overwritten.
DB<140> package Foo; sub bar { print __PACKAGE__."::bar => [@_]\n"} DB<141> package main; sub bar { print __PACKAGE__."::bar => [@_]\n"} DB<142> bar Foo+6; Foo::bar => [Foo 6] DB<143> use constant "Foo" =>5 DB<144> bar Foo+6; main::bar => [11]
But in the OP $q doesn't hold a filehandle.
UPDATE: Maybe the whole confusion started, when variables for filehandles were introduced.
Cheers Rolf
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: Operator precedence of unary plus (Bug or Feature)
by JavaFan (Canon) on Feb 05, 2012 at 20:29 UTC | |
|
Re^5: Operator precedence of unary plus (Bug or Feature)
by JavaFan (Canon) on Feb 05, 2012 at 20:22 UTC |