This looks like a very simple DOM manipulation: delete nodes from the DOM. I can do that in Firefox's developer tools. I am sure any DOM manipulator can do that. Specifically the Mojo::DOM suggested by marto should also be able to do it - but I have not used it before. In short: parse your html and convert it to a DOM, which is a Tree of html-tag nodes. Locate the node by xpath or other exotic selector. Zap the node and/or its children. Work at as high level as you can with this one because the spec will continually change and change and it will come to bite you.
Edit: I am not sure if the process of HTML -> DOM -> manipulate -> HTML will retain exactly the white spaces from the original HTML between tags as it seems you want to keep them given the test cases you provided.
I looked at Mojo::Dom briefly. It's a general purpose tool. Was hoping for a module that let me knock this out in in like two lines. Mojo::Dom is my fallback plan if I can't find what I'm looking for.
$PM = "Perl Monk's";
$MCF = "Most Clueless FriarAbbotBishopPontiffDeaconCuratePriest Vicar";
$nysus = $PM . ' ' . $MCF; Click here if you love Perl Monks