On 9/1/05, Juerd <[EMAIL PROTECTED]> wrote: > Ingo Blechschmidt skribis 2005-09-01 20:29 (+0200): > > for ($arrayref,) {...}; # loop body executed only one time > > Yes: scalar in list context. > > > for ($arrayref) {...}; # loop body executed one or three times? > > Same thing: scalar in list context. So once. > > > for $arrayref {...}; # loop body executed one or three times? > > Same thing: scalar in list context. So once. > > Scalars only automatically dereference in *specific* contexts. An > arrayref not used in Array context is still an arrayref, a hashref not > used in Hash context is still a hashref.
I would probably say that scalars never automatically dereference. It's lists and hashes that automatically dereference/enreference. 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. Luke