Pathologically Eclectic Rubbish Lister | |
PerlMonks |
Problem with counting the nodes in a hash created by XML::Simple from a XML file.by turbodizik (Initiate) |
on Jul 18, 2013 at 12:38 UTC ( [id://1045086]=perlquestion: print w/replies, xml ) | Need Help?? |
turbodizik has asked for the wisdom of the Perl Monks concerning the following question:
Dear community, I have a problem when I try to count the items in a hash variable which was created by XML::Simple from a xml file. My xml looks like:
if i try to count the <destination> items with scalar (keys $config->{log}->{destination}); AND there are more then 1 destinations, then it works fine. But if I reduce it in the xml to just one email address it throws an error: ___________________ The second problem which I have is to count the <item> nodes. If there are more then one nodes it works fine, like by <destination>. But if there is just one <item> node, it counts the nodes in this <item>. In my case it is 3 (<id>,<filename>,<extension>). The way I translated my xml file in Hash is:
I would be glad, if someone could help me, because I didn't find anything while googling... thanks a lot! Dimitri p.s by some reason the word array splits here automatically in "ar+ ray"
Back to
Seekers of Perl Wisdom
|
|