<div dir="ltr">I have this table data that I load into a template as follows.<br><div><br>  $q = "SELECT ID, NAME<br>                FROM jobs <br>                ORDER BY NAME";<br>       $sth = $dbh->prepare($q);<br>       $sth->execute();<br>       my $Jobs_ref = $sth->fetchall_hashref('ID'); <br>            <br>    template '<a href="http://sport_add.tt">sport_add.tt</a>', {    <br>     <br>    'Jobs' => $Jobs_ref,<br>    'Testing'   => "This is text to test to make sure this will come through", <br>      # to test, use this like <% Testing %> on your template page<br><br>}, {};<br><br></div><div>To display it in the template as a drop-down select I do:<br><br>    <select class="selectpicker" name="jobselect" id="jobselect" style="width: 500px;"><br>              <% FOREACH ID IN Jobs.keys %><br>        <option value="<% Jobs.$<a href="http://ID.ID">ID.ID</a> %>"><% Jobs.$<a href="http://ID.NAME">ID.NAME</a> %></option><br>        <% END %><br><br></div><div>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.<br><br></div><div>Thanks<br></div></div>