user1572656 user1572656 -4 years ago 61
HTML Question

How do I delete a specific HTML <table> with Perl?

I need to delete certain tables based on the contents of the table. I parsed the HTML using

to build an HTML tree.

I used
to delete the table but that only removes the table tag and leaves the contents of the table.

Please note that the tables are nested.

my $content = get($url);

my $tree = HTML::Tree->new();

my (@table_tags) = $tree->look_down( '_tag' , 'table' );
my $string = $table_tags[0]->as_HTML;

my $tree2 = HTML::Tree->new();

my (@table_tags2) = $tree2->look_down( '_tag' , 'table' );

Answer Source

What about using delete instead of replace_with_content?

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download