Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I'm parsing a simple XML structure like this one:
<?xml version="1.0"?> <Data> <Entry> <German> <Term>Vorstoss</Term> </German> <Italian> <Term></Term> </Italian> </Entry> <Entry> <German> <Term>Scheibe</Term> </German> <Italian> <Term>Cerchio</Term> </Italian> </Entry> </Data>
I'm using the following script:
#!/usr/bin/perl use strict; use warnings; use XML::Simple; my $XmlEncoded="ciao.tmex"; my $xml = XML::Simple->new(); my $LanguageName1="German"; my $LanguageName2="Italian"; my $data = $xml->XMLin($XmlEncoded); for my $entry ( @{ $data->{Entry} } ) { my $Term1 = $entry->{$LanguageName1}->{Term}; my $Term2 = $entry->{$LanguageName2}->{Term}; print "My terms: $Term1 - $Term2\n"; }
Why when a record is empty do I get a value like HASH(0x2a268f4)? And how can I avoid it and get a simple empty value? Thank you
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Parsing XML with XML::Simple
by choroba (Cardinal) on Jul 04, 2016 at 16:09 UTC | |
|
Re: Parsing XML with XML::Simple
by Preceptor (Deacon) on Jul 05, 2016 at 09:22 UTC | |
|
Re: Parsing XML with XML::Simple
by Jenda (Abbot) on Jul 10, 2016 at 09:35 UTC |