use 5.014; use XML::Simple; my $xmls = XMLin($xml_string); say $_->{AttrValue} for grep { $_->{AttrName} eq 'ref_num' } @{$xmls->{Attributes}->{Attribute}}; #### use Data::Dump; dd $xmls;