I have to apology for making mistake on the question ... i have wrote "=>" but i was thinking about this "->".

From perldoc i see that have 2 ways of using the reference. One way is to use "@" and the second is using ->

" Use Rule 1 You can always use an array reference, in curly braces, in place of the name of an array. For example, "@{$aref}" instead of @array."

"Use Rule 2 Use Rule 1 is all you really need, because it tells you how to do absolutely everything you ever need to do with references. But the most common thing to do with an array or a hash is to extract a single element, and the Use Rule 1 notation is cumbersome. So there is an abbreviation.

"${$aref}[3]" is too hard to read, so you can write "$aref->[3]" instead.

"${$href}{red}" is too hard to read, so you can write "$href->{red}" instead.

If $aref holds a reference to an array, then "$aref->[3]" is the fourth element of the array. Don't confuse this with $aref[3], which is the fourth element of a totally different array, one deceptively named @aref. $aref and @aref are unrelated the same way that $item and @item are."

"Similarly, "$href->{'red'}" is part of the hash referred to by the scalar variable $href, perhaps even one with no name. $href{'red'} is part of the deceptively named %href hash. It's easy to forget to leave out the "->", and if you do, you'll get bizarre results when your program gets array and hash elements out of totally unexpected hashes and arrays that weren't the ones you wanted to use."

So in this case "my $commissions = $sales->{tuesday}{jim};"

Shouldn't $commissions have the value from $sales in this case 3, 8 or something. The confusing part from this came from that line :). Here $commissions have a reference or point to reference, and as all books and doc saying that using a reference or getting the value is to pointing or use @ in front etc ...

And you say: "The values in its key-value pairs also happen to be references to hashes" The part that also confuse me is this: "tuesday => { jim => [ 3, 8 ], mary => [ 5, 5 ] }," .... Here tuesday is a hash or reference (it must be reference because $sales can have reference in this case or im wrong? pointing to other reference anonymous (because its created using "{}" brace and have jim (again it should be reference pointing to an array in this case or reference again, reference but im confused with [] ).

BIG apology for this noob questions :S, but i really love this language, it helps me a lot and i like to get in deep of it. Learn everything and good :)

And of course thanks in advanced for helping me !


In reply to Re: Hash of Hash by IvanAK
in thread Hash of Hash by IvanAK

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.