![]() |
|
Perl Monk, Perl Meditation | |
PerlMonks |
Re: Problem handling array from XML streamby bobf (Monsignor) |
on Jun 05, 2006 at 03:27 UTC ( [id://553525]=note: print w/replies, xml ) | Need Help?? |
First things first - I get a not well-formed error when I try to run your code. The fix is to quote the value of PROGRAM_COUNT in the Participant tag (PROGRAM_COUNT="3"). (Actually, that's the second error I got. The first thing I did was add use strict; use warnings; and then declare all of the variables.) On to business. From what I can tell, you're getting confused about how to use references. For example, in the following line you are assigning an array reference to an array, which is probably not what you intended to do. Either expand (dereference) the array ref to an array when you assign it, or simply assign the reference.
Secondly, you've got a typo in $programs->{status};. This key is capitalized in the XML ('Status'). Update: Thirdly, see Thelonius' reply to this node. Here is a corrected version of the code:
This prints:
The following links may help: HTH Update:Thanks to Thelonius for pointing out a correction to the code that I made but neglected to mention. I guess I was fixing faster than I was documenting. :-)
In Section
Seekers of Perl Wisdom
|
|