It looks like you want a parser. HTML::Parser will do almost exactly what you want, although you may need to handle the extra HTML tags in the input.
No. HTML::Parser low level, it doesn't give you tree. A html document is a tree ( Document Object Model).
You can use XML::Twig or HTML::TreeBuilder::XPath, XML::LibXML ...
Or as marto shows Mojo::DOM
In reply to Re^2: Match text from txt to html
by Anonymous Monk
in thread Match text from txt to html
by corfuitl
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |