in reply to What may be the problem in my code?

Looking at the documentation for XML::Simple it looks to me as though this is a feature, not a bug. It seems that XML::Simple strips off the name-value pairs and returns them without the name of the tag. Taken from the EXAMPLES section of the POD for XML::Simple:

When XMLin() reads the following very simple piece of XML: <opt username="testuser" password="frodo"></opt> it returns the following data structure: { 'username' => 'testuser', 'password' => 'frodo' }

It seems that XML::Simple expects you to use a named variable to hold the contents of the data structure, like this:

use XML::Simple; my $res = XML::Simple->new() my $a_tag = $res->XMLin($text);