in reply to Re: Strip specific html sequence
in thread Strip specific html sequence

Break it down to just the lines you want and fix those in isolation. SSCCE:

use strict; use warnings; use Test::More tests => 2; my $input = '</div></div><div><div class="blue"></div></div>'; my $expected = '</div></div>'; my $remove = '</div><div><div class="blue"></div>'; like ($input, qr/$remove/, 'Match found'); # Just for illustration $input =~ s/$remove//; is ($input, $expected, 'Strip successful');
Searching has suggested this is silly to try without a cpan solution

Quite right. If you start to attempt to parse HTML in this fashion you are starting down a long and slippery slope which ends in the belly of the grue. Recant now while there is still time.