use XML::Simple; use Data::Dumper; $XMLref = XMLin($xml_from_hm, suppressempty => '', forcearray=>1); if (ref ($XMLref->{Response}->[0]->{Program}->[0])) { @program_array = $XMLref->{Response}->[0]->{Program}; # Walk through the programs foreach $programs (@program_array) { @status_array = $programs->{status}; $one_program_name = $programs->{NAME}->[0]; # Walk through the statuses within each program foreach $status (@status_array) { $hold_desc = $status->{StatusDesc}->[0]; $hold_start = $status->{StatusDate}->[0]; $hold_end = $status->{StatusEndDate}->[0]; # a lot of other processing here } } }