http://qs321.pair.com?node_id=438481


in reply to reordering a stack with little effort

In perl, I would create an array of questions, each array element holding a reference to a hash:
my @questions # a question from the Tasmanian Devil push @questions, {id => 1, text => "Why for you want to bury me in the + cold, cold ground?, show => 1}; # etc.
Note here that QUESTION_NUM is just the index in the array plus 1.

Then inserting a question after question 10 is a simple matter of of a splice:

# Maxwell Smart? my $new_q = {id => 9, text => "Shall we use the Cone of Silence?, show + => 1}; splice @questions, 9, 0, $new_q;
For references to other questions, just add a reference => $quest_ref element to the hash.

-Mark