On Wed, Jun 22, 2011 at 6:44 PM, josanabr <john.sanab...@gmail.com> wrote:

> Hi,
>
> I'm reading a program written in perl and I read this statement
>
>
> --
> To unsubscribe, e-mail: beginners-unsubscr...@perl.org
> For additional commands, e-mail: beginners-h...@perl.org
> http://learn.perl.org/
>
>
>
Without any more information I would have to say good, and what do you want
form the list? (it really does help if you formulate a question and ask what
it is that you want to know ;-)

I suspect hat you are wondering what this means right?

Lets dissect this a little:

Lets take the inner most thing ($var2) this is obviously a scalar (or a
reference to another variable (I'll explain why I am betting it is a scalar
in a bit))
Then we see the following: $var1{...} this is the way one accesses a
variable in a hash based on the key (the thing that goes between those
brackets). Usually the keys used in a has are scalars of course there is
nothing stopping anyone from using complex data structures as a key but it
is performance wise not the smartest thing to do.
The last bit then @{...} basically says treat what is in side the brackets
as an array (which is what one would do if one is expecting an array
reference to be returned from $var1's value associated with key $var2.

So what would the data structure look like?
{
 "Hash key 1" => \[
                   'Array value 1',
                   'Array value 2',
                   ...
                  ],
 "Hash key 2" => \[
                   'Array value 1',
                   'Array value 2',
                   ...
                  ],
 ...
}

Or in text form: $var1 is an hash containing keys associated with values
which are references to arrays.

I hope that explains things a little bit. :-)

Regards,

Rob

Reply via email to