Sometimes you may have to write some code yourself... I posted a general example, given your example data, simply to show you how it can be done. The place is for helping people learn, people aren't always going to do it all for you. If you are writing code, reading the documentation for the tools you are going to use is literally the bare minimum you can do. 20 minutes to learn how to use something as portable and powerful as this seems insignificant compared to the productivity gains, and the alternative of writing all of the required code to do this properly yourself. If you think this is "something simple" you don't understand the scope of the problem at all. Look what you have achieved with this in 20 minutes! What is "monstrous" about the Mojo::DOM docs? It's littered with examples for how to use each method practically, with before and after data displayed.
"So why isn't a specific tool better than a general purpose tool? You're saying a specific tool is inferior because it has more dependencies?"
You tried two, neither of which did do what you imagined they would, and seemingly didn't take into account their dependencies. Having spent a long time working with perl and data, solving problems and writing code I suggested what I've found to be a tried and tested method that takes the pain out of what you're trying to do, in this instance. I didn't say anything about any other specific tools or problems.