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

Reply via email to