use strict; use warnings; use Data::Dumper; use HTML::HTML5::Parser; use XML::LibXML::Debugging; my $document = HTML::HTML5::Parser->load_html(IO => \*DATA); print Dumper( $document->toDebuggingHash ); __DATA__
Hello world |
##
my @all_tables = $document->querySelectorAll('table');
my $wanted_table = $table[2];
##
##
my @all_tables = $document->querySelectorAll('div.foo table');
my $wanted_table = $table[0];
##
##
my $wanted_table = $document->querySelector('div.foo table');