|There's more than one way to do things|
Problem with a Ref to a global variable while using XML::Parserby beamsack (Scribe)
|on May 28, 2002 at 21:28 UTC||Need Help??|
beamsack has asked for the
wisdom of the Perl Monks concerning the following question:
I am new to Perl and attempting to parse XML into an array of hashes using XML::Parser.
The script parses each child element of a <story> element into a hash. A reference to the hash is pushed on an array. When printing out the array of hashes, only the values from the last element parsed are displayed.
Overwriting the global hash is probably causing the problem.
I would like to either:
Create a lexically scoped hash variable but I am having difficulty due to the event driven XML::Parser subs (StartTag, EndTag, and Text)
Effectively deal with the global hash variable (by redefining it?)
thanks in advance monks -
Example of a story element