use 5.012; use warnings; use Data::Dumper; use XML::LibXML; my $xml = XML::LibXML->load_html(string => < Test
Infotext 1 Infotext 3 Infotext 4
Wert 1 Wert 3 Wert 4
EOF my %assoc; for my $key ($xml->findnodes('//td[@class = "title"]')) { my $pos = $key->findvalue('count(./preceding-sibling::td) + 1'); my ($val) = $key->findnodes("../following-sibling::tr[1]/td[position() = $pos]"); $assoc{$key->textContent} = $val->textContent; } print Dumper \%assoc;