in reply to reordering a stack with little effort
The question number as integer comes for free. Using a float as QUESTION_NUM is a good idea for less than approx. 1000 questions. Retrieve the db records in a sorted array via DBI::fetchall_arrayref.
foreach my $i (@questions){...}
Searching the array is affordable for converting from float to integer.
In Section
Seekers of Perl Wisdom