use strict; my ($order_by,$sql,$asc_desc); $sql = qq{SELECT * FROM TABLE}; $order_by = param('order_by'); $asc_desc = param('asc_desc'); if (defined($order_by)) { if ($asc_desc eq 'ASC') { $sql .= " ORDER BY $order_by ASC "; } else { $sql .= " ORDER BY $order_by DESC "; } } print header, start_html(), start_form(), center( p($order_by), start_table(), Tr(td(submit('order_by','FAULT_NO',)), td(submit('order_by','ISSUE')), td(submit('order_by','RESPONSE'))), end_table(), hidden('order_by',$order_by), hidden('asc_desc',$asc_desc), p($sql), ), end_form(), end_html(); exit;