use strict; use warnings; use Mojo::DOM; # Either load from file, URL, whatever, assign the html to a variable my $html = 'HTML here'; my $dom = Mojo::DOM->new( $html ); # find all svgs, remove each one found: $dom->find('svg')->each( sub{ $_->remove } ); #print to screen, or whatever you want to do print "$dom\n";