How are you storing the "multiple paragraphs"? If it's in a hash, what are you using for the key/value?
I would recommend not using a hash if the order means anything, as hashes do not preserve order, unless you name your keys paragraph1, paragraph2, etc. But that would really defeat the purpose of using a hash and would lean towards using an array. That being said, you should likley be using an array to store your paragraphs.
So to answer your question, there is no "reverse" for hashes, as hashes have no sense of order.
~Jeff
Ok, so that goes back to the point I made before, hashes are not arrays and arrays are not hashes. If you want to preserve the order, you should be using an array.So create an array called something like @QuestionArray. Then for each question, create a temp hash with 2 keys 'question' and 'answers'. The value of 'question' will be the question and the value of 'answers' will be an array of answers. Then push this temp hash into your array. This will preserve the order.~Jeff
Jeff,The problem i am facing is not about the order of answers in array, but its about the questions as the keys of hash.For example, data when put in DCr is in the following order:First Question >> First Answer ParaSecond Question >> Second First Para >> Second second ParaBut when I retrieve the hash, it gives me "Second Question" before "First Question" in order, whereas the answers are always associated with correct question and in correct order as well. ITS only the hash keys (which are QUESTIONS) that does not come in the order on which its put in.
my %QandA = ( "First Question" => ["First Answer Para"], "Second Question" => ["Second First Para", "Second Second Para"], ...);
my @QuestionArray = ({ 'question' => 'Q1', 'answers' => ['Q1 A1', 'Q1 A2', 'Q1 A3']},{ 'question' => 'Q2', 'answers' => ['Q2 A1', 'Q2 A2', 'Q2 A3']},{ 'question' => 'Q3', 'answers' => ['Q3 A1', 'Q3 A2', 'Q3 A3']},...);
Actually Adam, if you follow the posts all the way down, that's actually what he had already. The problem was with the order of his questions, not his answers. What he really wanted was:...Just wanted to clear up any confusion.~Jeff