in reply to Re: [Perl 6] Even more freedom for custom operators?
in thread [Perl 6] Even more freedom for custom operators?

I don't know about Perl 6, but Perl 5 parses code differently based on whether an operator or expression is expected. This probably makes such an operator impossible to implement. Worse yet, the context dependency happens with every basic math operator:

$y = 2+$x; # + = addition operator $y = +$x; # + = disambiguation operator $y = 2-$x; # - = subtraction operator $y = -$x; # - = arithmetic negation operator $y = 1*FOO; # * = multiplication operator $y = *FOO; # * = Glob sigil $y = 1/... # / = division operator $y = /... # / = match operator

How would you write something as simple as "$A multiplied by the negation of $x" using this operator?