Lvalue subroutines pretend to be assignable values, just like any ordinary variable. They do this by returning a proxy variable which handles the lvalue behavior for the subroutine (fetch, store, etc.). You declare an lvalue subroutine with the is rw property:
sub storage is rw { . . . } storage( ) = 5;
An lvalue sub can return an ordinary variable which acts as a proxy, return the return value from another lvalue sub, or it can return a tied proxy variable defined within the sub:
my sub assignable is rw { my $proxy is Proxy( FETCH => { . . . }, STORE => { . . . }, . . . ); return $proxy; }
This example defines an lvalue sub named assignable . It creates a proxy variable tied to a Proxy class that defines FETCH and STORE tie methods on the fly.