in reply to Why does foo() evaluate in array context in "${\foo()}"?
I would have expected that the $ sigil would have biased "${...}" towards a scalar context since the obvious value inside of {...} would naturally be a scalar reference.You are correct in the sense that ${EXPR} provides scalar context to EXPR.
Thus the thing that "\" takes a reference from should be presumed to be a scalar.But you are wrong here. You are assuming that \ propagates context. It doesn't. Only a few operators do, and \ isn't one of them. \ always provides list context to its arguments. Regardless of its own context. This is standard behaviour in Perl.
|
---|
In Section
Seekers of Perl Wisdom