in reply to how to self define a operator

Not exactly what you want, but since $p and $t seem to return objects, you are able to either

If that's too much of interference you can also define a private method

my $meth = sub { $_[0] .= $_[1]->reshape($_[0]->dims) };

And call it with

$t(1:2,0)->$meth( $p(0,1:2) )

from inside the same scope (untested)

This should come close to what you want.

HTH!

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

update

demo

DB<9> $op = sub { $_[0] + $_[1] } DB<10> p 4->$op(5) 9 DB<11>

Replies are listed 'Best First'.
Re^2: how to self define a operator (private method)
by toothedsword (Sexton) on Oct 22, 2019 at 15:10 UTC
    Great! It is a good method. Thanks!