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

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

Thread Previous | Thread Next
From:
Dave Mitchell
Date:
December 8, 2017 09:12
Subject:
Re: [perl #132537] possible documentation error in perldata
Message ID:
20171208091218.GF3070@iabyn.com
On Wed, Dec 06, 2017 at 06:02:52PM -0800, via RT wrote:
> https://perldoc.perl.org/perldata.html 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


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About