# ... data declarations as you have it (but with values "BCE" etc. quoted) 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 |