P
Page
I'm sure this has an easy answer, but I'm still learning.
I have the following code...
use XML::Simple;
my $simple = XML::Simple->new();
my $struct = $simple->XMLin("$map", forcearray => 1, keeproot => 1);
for (@{$struct->{treemap}->[0]->{label}}) {
my $lbldate = $_->{date}; if (ref($lbldate) eq "HASH") { $lbldate =
""; }
print '<div unselectable="on" class="lbl">'."\n";
print $_."\n"; # this is the line with the problem
print "</div>\n";
}
which reads the following XML file (code snipped to show relavent
XML):
<label date="09/28/2004">CONTRIBUTION</label>
<label date="09/28/2004">COST</label>
<label date="09/28/2004">MILES</label>
Everything seems to work fine, but instead of getting the words
"CONTRIBUTION", "COST", or "MILES", I get "HASH(0x1c282ec)". This
same code works fine for some other XML, so I'm confused. How do I
fix the line above to display the contents of the label object and not
the HASH?
I have the following code...
use XML::Simple;
my $simple = XML::Simple->new();
my $struct = $simple->XMLin("$map", forcearray => 1, keeproot => 1);
for (@{$struct->{treemap}->[0]->{label}}) {
my $lbldate = $_->{date}; if (ref($lbldate) eq "HASH") { $lbldate =
""; }
print '<div unselectable="on" class="lbl">'."\n";
print $_."\n"; # this is the line with the problem
print "</div>\n";
}
which reads the following XML file (code snipped to show relavent
XML):
<label date="09/28/2004">CONTRIBUTION</label>
<label date="09/28/2004">COST</label>
<label date="09/28/2004">MILES</label>
Everything seems to work fine, but instead of getting the words
"CONTRIBUTION", "COST", or "MILES", I get "HASH(0x1c282ec)". This
same code works fine for some other XML, so I'm confused. How do I
fix the line above to display the contents of the label object and not
the HASH?