Also, you don't need the '' around the key values. They'll just cause you trouble later.

They are unnecessary in this instance (and I'm lazy enough to leave out the quotes most of the time also), but I don't see how they'll cause trouble later. Actually, they'll save trouble if he decides to change the keys to something that is a perl keyword, or if perl changes and suddenly 'this', 'that' or 'myhash' becomes a perl keyword.

Update:Hmm, tye right. runrig wrong (see below). Key words and function names don't cause problems, but how 'bout this:
If you decide to add non-word characters later, it can cause trouble unless its quoted so it may save you from remembering to quote it. Or if you later decide to use a hash slice, you'll have to quote the arguments anyway. Or some people just think it looks better, so who am I to argue :)


In reply to Re: Re: Referencing to a hash inside a hash of hashes. by runrig
in thread Referencing to a hash inside a hash of hashes. by JPaul

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.