Enter.. HASHES! I'm really horrible at hashes, and I try to stay away from them as much as possible, but I think it is now time for me to give in and learn them.
On the user end, your end, the only difference between a hash and an array, is that one is ordered and uses number keys, and the other uses arbitrary key values. A key value being what goes in between the [] or {}. If you are good with arrays, you are good with hashes, so don't be too hesitant. Oh, and hashes can autovivify. Checking for $x{$y} creates the key,value pair $y,undef, so you'd use exists($x{$y}) instead. A minor thing.

Under the hood is where it starts to get complex, such as auto vivication, what they key really represents: an index or an arbitrary value which gets converted into a "unique" value etc. (you can have collisions, but they are uber rare)

The same problems you have with hashes, can occur in arrays, i.e. how you nest them and what's in nesting them.


In reply to Re: A Hash is a Hash (of course, of course) by exussum0
in thread A Hash is a Hash (of course, of course) by hacker

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.