I have this table data that I load into a template as follows. $q = "SELECT ID, NAME FROM jobs ORDER BY NAME"; $sth = $dbh->prepare($q); $sth->execute(); my $Jobs_ref = $sth->fetchall_hashref('ID'); template 'sport_add.tt', { 'Jobs' => $Jobs_ref, 'Testing' => "This is text to test to make sure this will come through", # to test, use this like <% Testing %> on your template page }, {}; To display it in the template as a drop-down select I do: <select class="selectpicker" name="jobselect" id="jobselect" style="width: 500px;"> <% FOREACH ID IN Jobs.keys %> <option value="<% Jobs.$ID.ID %>"><% Jobs.$ID.NAME %></option> <% END %> And it works great. Except for one thing, the list is not in order by name. I have read more than a few posts about how once you save a query as a hashref that the order is lost. Most of those posts suggested fetching as a arrayref instead. However, I have no idea how to do that and then display it in a select like the above code does. So I wanted to see if somebody perhaps knows of a not too complicated of a solution to get the select list into alphabetical order by name. Thanks