"be consistent" | |
PerlMonks |
Re^2: can sub check context for lvalue vs rvalue context?by perl-diddler (Chaplain) |
on May 09, 2018 at 03:00 UTC ( [id://1214251]=note: print w/replies, xml ) | Need Help?? |
What happens with Tie? Does it call a separate Store then Fetch?
Either way, a new value has to be passed into 'X', so it has to be called first in an lvalue context. Then it depends on whether or not perl makes a separate call to the function to do the equivalent of a fetch operation. If it does, the 2nd call would call it in rvalue context, but I'd think the 2nd call wouldn't happen, as perl would already have the value it stored and not need to make a 2nd call.
In Section
Seekers of Perl Wisdom
|
|