Perl question: array member of referenced hash

Perl question: array member of referenced hash

Shachar Shemesh shachar at shemesh.biz
Sat Oct 24 22:02:23 IST 2009


Dov Grobgeld wrote:
> Noam beat me to it, but here's perl solution without additional variables:
>
> #!/usr/bin/perl
>
> %hash = (a=>['moo','goo','woo'],
>          foo=>3,
>          baz=>5);
>
> $ref = \%hash;
> foreach my $elem (@{$ref->{a}})
Hi Dov,

Yes, it works. Now can you, please, explain to me why? What is the role 
of each bracket you used (and its location)?

Shachar

-- 
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/6b695ae2/attachment.html>


More information about the Linux-il mailing list