#!/usr/bin/perl

# use module
use XML::Simple;
use Data::Dumper;

# create object
$xml = new XML::Simple (ForceArray => 1);

# create XML document
$raw = <<EOF;
<?xml version='1.0'?>
<employee>
	<name>John Doe</name>
	<age>43</age>
	<sex>M</sex>
	<department>Operations</department>
</employee>
EOF

# read XML file
$data = $xml->XMLin($raw);

# access XML data
print Dumper($data);