in reply to how to self define a operator

no one mentioned it yet, but in case you don't really need a binary operator, you can go for a normal function, because arguments are "passed by alias" in Perl.

DB<11> sub op { $_[0] += $_[1] } DB<12> $x=4 DB<13> op($x,5) DB<14> p $x 9 DB<15>

as you can see, you can change the states of passed variables.

That's normally the most maintainable approach, especially when combined with a good name for the operation.

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery FootballPerl is like chess, only without the dice

Replies are listed 'Best First'.
Re^2: how to self define a operator
by toothedsword (Sexton) on Oct 22, 2019 at 15:08 UTC
    Thanks, it is a good idea.