sandy268 has asked for the wisdom of the Perl Monks concerning the following question:

Hi, I know that $x = 123; or $x = "something"; are valid variables, but the first bit or real code I looked at was written by an expert and I'm not sure as to the exact implications of this snippet. $y{left} = 400; $y{right} = 400; is it reserving 400 memory slots for both left and right? I do not seem able to find a reference to that. Regards Ian.

Replies are listed 'Best First'.
Re: variable variations $x(somthing)
by olus (Curate) on Feb 19, 2008 at 18:23 UTC
Re: variable variations $x(somthing)
by apl (Monsignor) on Feb 19, 2008 at 18:31 UTC
Re: variable variations $x(somthing)
by igelkott (Priest) on Feb 19, 2008 at 20:29 UTC
    Must of course agree that you should start with the language basics, but, in answer to your question (in general terms):
    1. "y" is a list, a list of keys with values
    2. "left" and "right" are members (keys) of that list
    3. these keys have been assigned the value of 400

    Note that $x(somthing) (from your title) is quite different than $x{somthing}.