sub by_parish { print $q->header,start_html( {-title=>"Kids Count Data for $choice$headline"}) , div({-align=>"center"}, $top, h2({-align=>"CENTER"},"Data for $choice$headline"), hr({-width=>"400"}), ), #div p( b($t[$k++]),br, ##iterate thru @ of table names table( {-width=>'600',-border=>'1'}, ##Population (1997) @toprow, parishdata_x3(),parishdata_x3(),parishdata_x1(), ##call the subs to print either 3 data cells or 1 ), #table ), #p p( b($t[$k++]),br, table( {-width=>'600',-border=>'1'}, ##Poverty (1995) @toprow, parishdata_x1(),parishdata_x1(), ), #table .... #and so on sub parishdata_x3 { Tr({-align=>"right"}, td( {-align=>"center"}, b($r[$j++]), ), #iterate thru @ of row labels td( {-bgcolor=>"$data"}, @{$info{$choice}}[$i++] ), #iterate thru alpha sorted hash from excel file td( {-bgcolor=>"$data"}, @{$info{$choice}}[$i++] ), td( {-bgcolor=>"$data"}, @{$info{$choice}}[$i++] ), ); } sub parishdata_x1 { Tr({-align=>"right"}, td( {-align=>"center"}, b($r[$j++]), ), td( {-bgcolor=>"$data"}, " "), td( {-bgcolor=>"$data"}, " "), td( {-bgcolor=>"$data"}, @{$info{$choice}}[$i++] ), ); }