http://qs1969.pair.com?node_id=437429


in reply to XML::Simple help

Here is my try with XML::Twig.

use XML::Twig; my $hash; my $t= XML::Twig->new( twig_handlers => { charge => sub{ $hash->{$_[1]->{'att'}-> +{'code'} }=$_[1]->{'att'}->{'name'}}, }, ); $t->parse( '<charge-type-control> <charge code="FRT" name="frtamt"/> <charge code="SV1" name="savamt"/> <charge code="SV2" name="savamt"/> <charge code="SV3" name="savamt"/> <charge code="SV4" name="savamt"/> <charge code="SV5" name="savamt"/> </charge-type-control>'); print $_."\t".$hash->{$_}."\n" for keys %{$hash};

regards
Murugesan Kandasamy