I have the following arrays with different lengths
Actually, you have one array and a hash. This means you can do a simple lookup for each element of the array (i.e. $data{$element} ).
The following snippet would, for example, produce the output you want:
# ... data declarations as you have it (but with values "BCE" etc. quo +ted) print "| |", (map sprintf(" %8s |", $_), @headers), "\n"; + # print column headers print "| 1 |", (map sprintf(" %8s |", $data{$_}||""), @headers), "\n"; + # print row of data __END__ | | 2011-34 | 2011-35 | 2011-36 | 2011-37 | 2011-38 | 2011-39 +| 2011-40 | 2011-41 | | 1 | BCE | YZA | MID | KAL | | WUL +| | YOK |
P.S. please put <c> ... </c> around code sections of your post. This makes it easier to read.
In reply to Re: Need Help Mapping Arrays
by Eliya
in thread Need Help Mapping Arrays
by tqlam
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |