develooper Front page | perl.perl5.porters | Postings from December 2017

Re: [perl #132537] possible documentation error in perldata

Thread Previous | Thread Next
Dave Mitchell
December 8, 2017 09:12
Re: [perl #132537] possible documentation error in perldata
Message ID:
On Wed, Dec 06, 2017 at 06:02:52PM -0800, via RT wrote:
> says:
> >LISTs do automatic interpolation of sublists. That is, when a LIST is evaluated,
> >each element of the list is evaluated in list context, and the resulting list
> >value is interpolated into LIST just as if each individual element were a member of LIST.
> This seems to be wrong, in the sense, that the list
> itself doesn't mandate its elements to be evaluated
> in list context.

It does by definition:

> When doing $b=(1, 2, @a); the list is evaluated in scalar context

No, in scalar context, there isn't a list; instead there is merely
a sequence of comma operators (which return their RH argument), with
parentheses added for the purpose of precedence.

Hofstadter's Law: It always takes longer than you expect, even when you
take into account Hofstadter's Law.

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About