I am not completely sure what you want, but I think you want a hash of arrays and how to create and or access them.
Here is a little example of one way.
#!/usr/bin/perl
use strict;
use warnings;
my %zipcodes;
foreach my $row (2..10) {
my $zip = "020" . $row;
my $f = "f-$row";
my $l = "l-$row";
my $e = "e-$row";
#create a hash of arrays holding our values
$zipcodes{$zip} = [$zip, $f, $l, $e];
}
#cycle through the hash and print out all values
foreach my $key (sort keys(%zipcodes)) {
print "key = $key";
print " fn = " .$zipcodes{$key}->[1];
print " ln = " .$zipcodes{$key}->[2];
print " e = " .$zipcodes{$key}->[3] . "\n";
}
As you can see I tried to use most of your information.
I used the hash zipcodes and added an array to each zipcode ( $zipcodes{$zip} = $zip, $f, $l, $e; ).
In the second half of the program I cycle through the hash using the 'keys' keyword and access the individual members of the associated array when printing them out.
I hope this helps and is what you wanted.
s&&VALKYRIE &&& print $_^q|!4 =+;' *|
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.