On 07/25/2006 03:36 PM, BW wrote:
Mumia W. wrote:
Did you enable ForceArray?

Did you use Data::Dumper to look at the structure of
what XML::Simple returned?

Yes to both.  I've attached the Dumper output.
(outp.txt).  Given the attached xml file, and your
first snippet/example, I tried to do something very
simple:  print out my dataschema name:

foreach $d (@{$data->{dataschemas}}) {

Why {dataschemas} when the data is in {dataschema} (no "s")?

  print "Dataschema: $d->{name}\n";
}

It won't print.  I won't include all the variants on
the $d->{name} line I've tried, but all the results
are the same:  nothing outputs.

[...]
$VAR1 = {
          'dataschema' => {
[...]

This was the purpose of using Data::Dumper--to show that all
of the data is under {dataschema}. People use Data::Dumper to find out what the structure of their data is, and then write a program to deal with that structure.

Also, please enable strictures and warnings for your program
by placing these lines at the top:

use strict;
use warnings;

Then modify your program to run under these conditions (a lot
of work, but it pays off in bug prevention.)

From the XML::Simple doc, did you read this?
 ยท   check out "ForceArray" because you'll almost certainly want to turn
     it on

XML::Simple does some pretty weird stuff unless you use ForceArray, so always use ForceArray; ForceArray is what makes XML::Simple simple.

And please don't snip attributions.



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to