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};

Murugesan Kandasamy

In reply to Re: XML::Simple help by murugu
in thread XML::Simple help by mifflin

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":