<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>