On 9/2/05, Juerd <[EMAIL PROTECTED]> wrote:
> Luke Palmer skribis 2005-09-01 23:43 (+0000):
> > I would probably say that scalars never automatically dereference.
> > It's lists and hashes that automatically dereference/enreference.
>
> arrays
Yes, arrays, right.
> > That is, everything is a scalar, really, but if you have an @ or a %
> > on the front of your variable, that means that you flatten yourself
> > into specific kinds of contexts.
>
> sub foo (@bar) { ... }
>
> foo $aref;
>
> Here $aref is dereferenced because of the Array context. The scalar
> can't do this by itself, of course.
No, my view is that $foo and @foo are really the same kind of thing.
They're both references to lists (yes, lists). So binding @bar :=
$aref is not doing anything special, it's just like binding two
scalars. The only thing that makes @bar different from $aref is that
in list context, @bar flattens out the list it's holding whereas $aref
doesn't.
Luke