#!/usr/bin/perl use warnings; use strict; use feature qw{ say }; use XML::LibXML; my $dom = 'XML::LibXML'->load_html( string => do { local $/; <> =~ s/\\"/"/gr }); for my $row ($dom->findnodes('//table/tbody/tr')) { my @cells = $row->findnodes('td | th'); say join ' ', map $_->textContent, @cells[0, 1]; }