RE: How to keep a particular order of a associative array when using LWP
Axel Amthor (axel.amthor@interprise.de)
Sun, 16 Aug 1998 00:40:40 +0200
I have followed this dicussion with some interest, 'cause i had
similar problems a few days ago.
There are a few solutions (which need no additional Perl Mod's):
* a second Array, which will hold the sort order of the keys. This
might be no solution in a generic procedure.
* the number-solution which is suggested in a former posting.
or (i'm not shure, if this really works)
* just pop-ing the values
from the Array than getting it out of the hash by keys and push-ing them
into
another. re-pop-ing them or inverting the array will produce the original
sort order.
On the other hand, i'm wondering whether any app has to now the
order of some fields in the gui. Change your basic design!
cu
Axel Amthor Interprise Network Computing GmbH
Witneystr. 1, 82008 Unterhaching
mail: axel.amthor@interprise.de
Fone: +49 (0) 172 5101 776
Fax: +49 (0) 2951 92972
> -----Original Message-----
> From: libwww-perl-request@ics.uci.edu
> [mailto:libwww-perl-request@ics.uci.edu]On Behalf Of
> shiwan.li@convergys.com
> Sent: Freitag, 14. August 1998 22:09
> To: libwww-perl@ics.uci.edu
> Subject: How to keep a particular order of a associative array when
> using LWP
>
>
> 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.
>
>