if ($query->param('text1')) { foreach (sort ( $query->param('text1'), $query->param('text2'), $query->param('text3'), $query->param('text4'), $query->param('text5') )) { print "$_\n\n"; } }