If you want to use arrays to save space, it can be helpful to set up constants for your indexes.

use constant ID => 0; use constant FIRST_NAME => 1; use constant INITIAL => 2; use constant LAST_NAME => 3; # Processed data would look like this: my @data = ( # ID FNAME MI LNAME [qw( dramaya Daniel R Amaya )], [qw( bjsmith Bob J Smith )], [qw( abjones Angela B Jones )], ); # Access your data: foreach my $entry (@data) { my $id = $entry->[ID]; my $fname = $entry->[FIRST_NAME]; # or you could do: my ( $first, $mi, $last, $id ) = @{$entry}[ FIRST_NAME, INITIAL, LA +ST_NAME, ID ]; }

Using constant array indexes can be a nice help for readability.


TGI says moo


In reply to Re: Loading file into memory by TGI
in thread Loading file into memory by walkingthecow

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.