in reply to Need Help Mapping Arrays
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Need Help Mapping Arrays
by raybies (Chaplain) on Aug 23, 2011 at 17:27 UTC |