I finally had my first Perl epiphany the other week.

Someone had posted to a newsgroup about how to extract arrays from a hash. Not being a programmer by trade, but more by happenstance, I still feel sorry for those among us (like myself) who are not gurus. Anyway, I thought I'd take a crack at explaining it, since I was curious myself. I made myself a little hash of arrays of arrays, and pondering it meditatively, I thought to myself: if only scalars are stored in the symbol table, why can't I just use the scalar name of the first array in the first array to get at the values of that array (what a mouthful!).

It all seemed too easy, so I quickly finished up the script to test whether

@extract = @{$hoa{'arrays'}[0]}
would grab the values I wanted. I was so amazed I had to look it up in the camel book just to make sure I hadn't made a discovery that would rock the Perl community to its foundations (okay, just to make sure I was right).

Anyway, that was the point at which referencing and dereferencing values suddenly made a whole lot more sense to me.

So beware Perl gurus, wherever you are; I'm on my way to the top!

matt


In reply to Things that make you go hmmm by mattg

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.