use XML::Simple qw(:strict); my $xmlFile = 'textResults.xml'; my $xmlDocument = XMLin($xmlFile, ForceArray => 1, KeyAttr => {}, ); foreach my $httpSample (@{$xmlDocument->{httpSample}}) { print qq|$httpSample->{assertionResult}->[0]->{failure}->[0]\n|; print qq|$httpSample->{assertionResult}->[0]->{error}->[0]\n|; print qq|$httpSample->{assertionResult}->[0]->{failureMessage}->[0]\n\n|; }