Perl question: array member of referenced hash
Shachar Shemesh
shachar at shemesh.biz
Sat Oct 24 22:14:45 IST 2009
Noam Rathaus wrote:
> Shachar,
>
> { } in Perl are casting when they surround a value
> And the second set of { } around the 'a' mean variable of Hash
>
>
>
Grumble grumble grumble....
Okay, I'm sorry for being difficult. I really couldn't find the answer
in the Perl documentation.
I understand the second set of curly braces. I also, somewhat,
understand that the -> replaces the % (i.e. - reference dereferencing).
What I'm not so clear is what the first set of curly braces do (what do
you mean by "casting" - casting to what? How is that decided?). I'm also
not clear on why the surrounding round brackets are needed. I understand
they are so this will be a list context, but I don't understand why it's
needed once I put a @ to dereference the array.
Thanks,
Shachar
>
>> foreach my $elem (@{$ref->{a}})
>>
--
Shachar Shemesh
Lingnu Open Source Consulting Ltd.
http://www.lingnu.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.cs.huji.ac.il/pipermail/linux-il/attachments/20091024/f164f420/attachment.html>
More information about the Linux-il
mailing list