John Barnette wrote: > John Porter wrote: > > The punctuation imposes context on the variable expression. > > $foo[0] > > accesses an array. Where's the "@"? > > It accesses an *element* of the array, which is a scalar. Still, the "$" does not describe the type of the variable, which in this case is an array. The "$" imposes scalar context on the expression "foo[0]". What is in foo[0] is irrelevant. > Where's the confusion? Right here, apparently. The punctuation (so-called) is NOT descriptive of the variable's type, despite what some people say. If it were, then the parser would see "$foo" and immediately conclude that the variable is a scalar. But no, it has to keep scanning until it finds other stuff, like {} or [], to decide what type "foo" is. -- John Porter
- Re: RFC 109 (v1) Less line noise - let's ... Ariel Scolnicov
- Re: RFC 109 (v1) Less line noise - le... John Porter
- Re: RFC 109 (v1) Less line noise... Ariel Scolnicov
- Re: RFC 109 (v1) Less line noise... David Corbin
- Re: RFC 109 (v1) Less line noise... David Corbin
- Re: RFC 109 (v1) Less line noise - let's get ... John Porter
- Re: RFC 109 (v1) Less line noise - let's get rid of @% John Porter
- Re: RFC 109 (v1) Less line noise - let's get rid ... John Barnette
- Re: RFC 109 (v1) Less line noise - let's get ... Jonathan Scott Duff
- Re: RFC 109 (v1) Less line noise - let's ... John Barnette
- Re: RFC 109 (v1) Less line noise - let's get ... John Porter
- Re: RFC 109 (v1) Less line noise - let's get rid ... Russ Allbery
- Re: RFC 109 (v1) Less line noise - let's get rid of @% John Porter
- Re: RFC 109 (v1) Less line noise - let's get rid ... Nathan Torkington
- Re: RFC 109 (v1) Less line noise - let's get ... John Porter
- Re: RFC 109 (v1) Less line noise - let's get rid of @% Steve Fink
- Re: RFC 109 (v1) Less line noise - let's get rid ... Ted Ashton
- Re: RFC 109 (v1) Less line noise - let's get ... Steve Fink
- Re: RFC 109 (v1) Less line noise - let's ... Damien Neil
- Re: RFC 109 (v1) Less line noise - le... Steve Fink
- Re: RFC 109 (v1) Less line noise - let's ... Ted Ashton