Assign method call to hash value?

gvim gvimrc at gmail.com
Tue Jan 29 13:04:18 GMT 2013


On 29/01/2013 12:44, pierre masci wrote:

> 1. "assigning $r->method" does not invoke any context.
> In this case, the context is "we are inside a hash".
>
> 2. A hash is a list.
> It's just a list which knows that its elements are "coupled" 2 by 2.
> As a consequence, inside a hash you are in list context.
>
> 3. In this list context, any method that is context-sensitive will
> return a list.
> If you want to force your method to return a scalar anyway,
> you have to use the scalar() function.
>
> Is that clear?
> If not, which part is not clear?
>

Yes, clearer, thanks. My understanding was that, yes, a hash is a list 
but I mistakenly assumed it meant a list of scalars.

gvim


More information about the london.pm mailing list