I really don't see why you shouldn't do it the way you have it coded here.
because, one, I might not know what the variable names are (they may be variables... as alluded to below), and two, it just gets tiring typing out a hash structure especially if a lot of fields are involved. Tom's suggestion below works well for such a problem.

Why are the variable names important if you know what each column represents? A hash structure is indeed useful for HTML::Template so you can refer to that data by name in the template, which is, for most people's purposes, completely separate from the code. (In templates there is no guarantee that the person editing the template will know anything about structures in the code.) But with the AofA, you know that $crazypersonarray->[0] is a lastname *variable* and so on. You could even assign $ln = 0 and refer to it as $crazypersonarray->[$ln]. Your array of hashes can be accessed using something like print $hash->{ln} for my $hash ( @aoh );. That said, I think you should use what feels intuitively "right". :)

--
Allolex


In reply to Re:^5 another 'array to hash' question by allolex
in thread another 'array to hash' question by punkish

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.