in reply to Removing HTML beginning and ending tag with everything in between?
For that very specific text, your substitution does work. (There's a syntax error building your string because you use " as a delimited and you didn't escape the " characters within the string.)
Using XML::LibXML (which has an HTML parser), it would be:
for my $node ($root->findnodes('//div[@id="print"]')) { $node->parentNode()->removeChild($node); }
|
|---|