my @nodes = $tree->findnodes('//ul'); for my $node ?(@nodes) { my $text2 = $node->findvalue('li') or next; if ($text2 =~ m/connection details are/) { print "$text2\n"; my @text = $node->findvalues('/tr/td'); print @Dumper \@text; } }