|Perl Monk, Perl Meditation|
Re^6: Is this a bug, or expected behavior?by fizbin (Chaplain)
|on Mar 17, 2006 at 17:20 UTC||Need Help??|
Okay, that now makes sense.
What actually helped shed light on it was using your ctx function in this code:
Which now all makes sense, except for the "args3" being evaluated before "args1". That seems like a rather bizarre evaluation order.
The contexts inside () on the function references are all array context, and the context inside  is array or scalar depending only on the immediately surrounding syntax. The context of the function called by the dereference itself depends on the surrounding code.
I guess if TIEARRAY worked better, I'd be able to tie the array that $a points to and see that the FETCH method was getting called with different contexts depending on the code surrounding the array ref, even though the context applied to the expression generating the index was determined only by wheter I'd used the slice syntax or not. Unfortunately, it appears that FETCH is always called in scalar context, no matter what.