'record' => [ { 'xmlns' => 'http://www.loc.gov/MARC21/slim', 'xmlns:xsi' =>something', 'xsi:schemaLocation' => somehtml', 'datafield' => [ { 'ind1' => ' ', 'ind2' => ' ', 'subfield' => [ { 'content' => '0047-3936', 'code' => 'a' } ], tag' => '022' }, { 'ind1' => '1', 'ind2' => '0', 'subfield' => [ { 'content' => 'more content here', 'code' => 'a' } ], 'tag' => '245' } ] }, repeat this structure entry x10 #### my $xml = new XML::Simple (ForceArray => 1, KeyAttr=>[]); $data = $xml->XMLin($dirtyxml); foreach $record(@{$data->{present_response}->{record}}) { $gooddata=$record->{xmlns}; push(@title, $gooddata); } foreach (@title) { $list = $list."

".$_."

"; } my $output = "

".$list."

"; return($output); ##
## foreach $subfield (@{$data->{present_response}->{record}->{datafield}->{subfield}}) { $gooddata=$subfield->{content}; push(@title, $gooddata); }