|There's more than one way to do things|
Putting an array into a hashby Theo (Priest)
|on Dec 10, 2004 at 05:55 UTC||Need Help??|
Theo has asked for the
wisdom of the Perl Monks concerning the following question:
I have some alumni data from which I need to extract useful info. To that end I'm trying to go from the native (pseudo)XML file to a key/value hash.
Before stripping out the excess XML tags the @info array has the full record of one person, a sample of which is in Listing 1. Listing 2 is printed by the code segment shown and the error message is below that.
I've preloaded %data hash just to be sure I can see if there are any changes in the hash.
I'd like to know what the error means, but the real question is how to transform an array into a hash.
The nature of this data is that the keys will all be unique.
(code being tested on a Win98 PC using Active State version 5.005_03)
Due to the embedded spaces in some of the data, a better approach might be to strip the XML and create the hash in the same step, but not till I can get through this problem.
-Theo- (so many nodes and so little time ... )