http://www.perlmonks.org?node_id=1016325


in reply to Re^2: XML Parsing
in thread XML Parsing

Quite simply $hash_when_cat_eq_special is a pointer to a hash. So you can do your normal hash operations on it. The ->pointer() function returns this for you.

In terms of the foreach:

foreach my $elem ( @{ $xml_obj->{list}{value} } ) { $hash_of_subtree = $elem->pointer() ; }

The advantage here is that $xml_obj, $xml_obj->{list} ... are all Objects of type XML::Smart and can always be used as either a hash OR an array.

To extract your data you can simply use the 'pointer' function ( $xml_smart_obj->pointer() )that will return the hash structure or the 'content' function ( $xml_smart_obj->content() ) that will return the contents of a node.