foreach $header (@$headers) { ... } #### use strict; use DBIx::XHTML_Table; my $table = DBIx::XHTML_Table->new("insert db credentials"); $table->exec_query(" select data_name, sum(data_value) from dwhs.store_reports where report_type = ? and timestamp >= sysdate - ? group by data_name ",[$list_name,$day_list]); $table->modify_tag(table => { border => 3, cellspacing => '0', cellpadding => '0', width => '100%', }); $table->modify_tag(td => { bgcolor => '#CCCCCC', align => 'center', }); print $table->get_table();