my $sort_order = $q->param('sort_order');
my $order = $q->param('order');
print '
';
foreach(@column_headings){
print "| $_ | ";
}
print '
';
my @records = ##Get your data, maybe an array of hashes??
@records = reverse(@records) if($sort_order eq 'asc');
foreach(@records){
##Output records
}