Perl300 has asked for the wisdom of the Perl Monks concerning the following question:
I am trying to read values of tag1 and tag2 in distinct variables and have tried few options one of which is:$VAR1 = { 'cmts' => { 'STBDSG' => { 'dsg' => [ { 'tag1' => '1', 'tag2' => 'caSystemId', }, { 'tag1' => '2', 'tag2' => 'gaSystemId', } ] },
There are no compilation errors but nothing is printed when I run the script even though tag1, tag2 have values after xml is parsed. I am parsing xml using:my $dsg_tags = $xst->{cmts}->{STBDSG}->{dsg}; for my $dsg (@$dsg_tags) { print "Value of tag1 :"; print $dsg->{tag1}, "\n"; print "Value of tag2 :"; print $dsg->{tag2}, "\n"; }
Can you please help me if I am missing something here and suggest me how to correct it. I am also trying to find from net and CPAN documentation. Thanks in advance!my $xst; if((not defined $xml) or ($xml =~ m/read\stimeout/i)){ &printXMLErr('request timed out'); } else { my $xs = XML::Simple->new(); $xst = eval { $xs->XMLin($xml,KeyAttr=>1) }; &printXMLErr($@) if($@); }
|
|---|