#!/usr/bin/perl use strict; use warnings; use Mojo::DOM; my $html = <<"END_HTML"; test END_HTML # Create DOM my $dom = Mojo::DOM->new( $html ); # Find the first 'a' tag with 'second' class, remove the parent tag $dom->find('a.second')->first->parent->remove; print $dom->content; #### test #### test