in reply to Re^2: interpolating a variable into an operator
in thread interpolating a variable into an operator

Perhaps a filter that changes

EXPR1 ´$binop´ EXPR2
to
$The::Module::binops{$binop}->(EXPR1, EXPR2)
:-)

Some ops won't be fully supported though, like x (see Re: Using x to build data structures considered harmful).

ihb

Replies are listed 'Best First'.
Re^4: interpolating a variable into an operator
by diotalevi (Canon) on Jul 20, 2004 at 20:44 UTC

    Perl is best treated like lisp by being lisp-like. Go after the optree directly and both cases look like multiply( EXPR1, EXPR2 ) and repeat( EXPR1, EXPR2 ). I don't know how you thought to solve this where * is overridable but x isn't. Care to share?