in reply to Re^2: can sub check context for lvalue vs rvalue context?
in thread can sub check context for lvalue vs rvalue context?
So I'd say that x() is primarily in lvalue context here.
That implies it has a secondary context. It doesn't. When an lvalue sub is called, it always does the same thing. Returns an lvalue to the calling context.
And what's being assigned to @x is not the return value of x(), but the return value of the assignment operation, which is an lvalue itself.
What is assigned to @x, is the result of the rvalue expression. And that, is the result of the assignment to lvalue returned by the subroutine.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: can sub check context for lvalue vs rvalue context?
by haukex (Archbishop) on May 10, 2018 at 11:20 UTC |