Hello,
It is not Perl but MySQL who should sort the result for you. When you prepare() your query, you should pass an SQL like this:
When you excute() this, you will get all the TIME fields' values from times table in ascending order. If descending, you append DESC keyword to the above.
I'm not sure what you wanted to do with the ID, but database tables are not like spreadsheet, and each row is an independent record from others, so you can't sort one column and leave the other columns unchanged (or sorted in another way). I would perhaps get IDs in a separate query and sort it as well, combine them with the sorted TIME side-by-side and put them all into one table to get what I think you wanted.
For more info about MySQL, consult the following:
MySQL Documentation:
http://www.mysql.com/documentation/index.html
For Perl-side of operations (handle retrieved data in a loop, etc), you can go to Perl forum or start with something like here:
http://www.danchan.com/feature/2000/...sql/mysql3.htm
Hope this helps.