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.
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.