Hi, I have just started to study XML::Study module. below is my script.
use warnings; #use strict; use XML::Simple; use Data::Dumper; my $xml = XML::Simple->new(); my $data = $xml->XMLin("data1.xml"); print Dumper($data);
and here is my xml file.
<?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>
output what tutorials are getting (which seems correct) is
$data = { 'employee' => [ { 'department' => 'Operations', 'name' => 'John Doe', 'sex' => 'M', 'age' => '43' }, { 'department' => 'Accounts', 'name' => 'Jane Doe', 'sex' => 'F', 'age' => '31' } ] };
& what I am getting is
$VAR1 = { 'employee' => { 'John Doe' => { 'department' => 'Operations', 'age' => '43', 'sex' => 'M' }, 'Jane Doe' => { 'department' => 'Accounts', 'age' => '31', 'sex' => 'F' } } };
why this mismatch..please help.. I installed module using cpan command prompt method...I am not root just a user.. and working on ubuntu...thanx
In reply to XML::Simple Not getting the proper output. by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |