djbryson has asked for the wisdom of the Perl Monks concerning the following question:
$xml = new XML::Simple;
$data = $xml->XMLin("data.xml");
print $data->{employee}->[0]->{name};
So, trying to print out one of the names... can't get the syntax right. If I go: print $data->{employee}; I get a hash reference... does that mean I have to put it into a hash first?<?xml version='1.0'?> <employees> <employee> <name>John Doe</name> <age>43</age> <sex>M</sex> <department>Operations</department> </employee> <employee> <name>Jane Doe</name> <age>31</age> <sex>F</sex> <department>Accounts</department> </employee> </employees>
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: XML::Simple - multi level
by runrig (Abbot) on Dec 07, 2007 at 20:29 UTC | |
|
Re: XML::Simple - multi level
by olus (Curate) on Dec 07, 2007 at 21:18 UTC | |
by djbryson (Beadle) on Dec 11, 2007 at 16:58 UTC |