#!/usr/bin/perl use XML::Simple; use Data::Dumper; my $xml = qq| 3 Are dingos your friend? Satisfactory 11 Should this run out of memory? No |; my $xml_ref = XMLin($xml); print $xml_ref->{'QuestionList'}->{'Question'}->[0]->{'Answer'};