foreach my $info ($root->children('data')){ my $INTEREST2 = $drug->first_child_text('groups/group'); print "$INTEREST2"; print "\n"; }