my %lookup = ( FAULT_NO => 'FAULT_NO', ISSUE => 'ISSUE', RESPONSE => 'RESPONSE', ); # task of automating the creation of the hash # is left as an excerise to the reader ;) #### $order_by = $lookup{ param('order_by') }; $order_by_check = $lookup{ param('order_by_check') }; if ($order_by) { ... } ...