if( ref( $XMLref->{Response}[0]{Program}[0] ) ) { my $program_arrayref = $XMLref->{Response}[0]{Program}; # Walk through the programs foreach my $programs_href ( @{ $program_arrayref } ) { my $status_aref = $programs_href->{Status}; my $one_program_name = $programs_href->{NAME}; # Walk through the statuses within each program foreach my $status_href ( @{ $status_aref } ) { my $hold_desc = $status_href->{StatusDesc}[0]; my $hold_start = $status_href->{StatusDate}[0]; my $hold_end = $status_href->{StatusEndDate}[0]; # a lot of other processing here print join( ':', $one_program_name, $hold_desc, $hold_start, $hold_end ), "\n"; } } }