You're welcome. But be aware, XML::Simple plays not nice sometimes. Change your xml file to the following and show what happens:
<?xml version="1.0" encoding="utf-8"?>
<ApiResponse Status="OK" xmlns="http://api.namecheap.com/xml.response"
+>
<Errors />
<Warnings />
<RequestedCommand>namecheap.domains.getList</RequestedCommand>
<CommandResponse Type="namecheap.domains.getList">
<DomainGetListResult>
<Domain ID="8888999" Name="Domain4.com" Expires="05/20/2015"/>
</DomainGetListResult>
<Paging>
<TotalItems>4</TotalItems>
<CurrentPage>1</CurrentPage>
<PageSize>50</PageSize>
</Paging>
</CommandResponse>
<Server>API02</Server>
<GMTTimeDifference>--5:00</GMTTimeDifference>
<ExecutionTime>0.008</ExecutionTime>
</ApiResponse>
You'll see your script dies.
XML::Simple creates an array ref when it sees more than one element, but a simple hash ref when there is one.
Instantiate you XML::Simple object this way to force that the one element is always handles as an array:
my $result = $xml->XMLin("myouput.xml", ForceArray => ['Domain']);
When you start learning XML handling modules have a look at XML::Twig.
McA |