Re: How to keep a particular order of a associative array wh

Andy Lester (alester@fsc.follett.com)
Fri, 14 Aug 1998 16:48 -0600


As you have found out, you cannot guarantee the order of a hash.  A hash is 
not an ordered construct.  Fortunately, we still have lists.  You'll need 
to make a list of references to your hash, basically.




______________________________ Reply Separator _________________________________
Subject: How to keep a particular order of a associative array when u
Author:  shiwan.li@convergys.com at internet
Date:    8/14/98 4:08 PM


I need some experts' help!

I'am writing a CGI Perl Script that can accept the end user input from the 
browser and parsed those name value pairs using LWP to a back end 
application to generate dynamic page.  The script is working for the most 
occassion, it parses all the name value pairs to the back end dll file and 
the order of those name value pairs doesn't matter.   But there is one 
place for the back end dll which requires the name value pairs to be parsed 
in a particular order (ie. the order that was parsed from the client 
browser should be the order for those name value pairs to be parsed into 
the back end).

In the script,  I'm using an associative array to hold all those name value 
pairs and then parsed them to the back end application (another dll file on 
another web server).   As associative arrays always are stored in "random" 
order, I cannot guarantee that the original order of the name value pairs 
are kept.

Has someone come accross this situation before and can give me some hints. 
Thank you in advance.