http://www.perlmonks.org?node_id=607176


in reply to Re: read a file and insert closing tags if not present
in thread read a file and insert closing tags if not present

Hi grandfather, This is the code which i tried.
require HTML::TokeParser; $p = HTML::TokeParser->new("output.xml") || die "Can't open: $!"; $p->empty_element_tags(1); open(FH, "output.xml"); print FH $p; close FH;
output.xml
<greeting class="simple">Hello, world!
The above file is a sample file which i tried to insert the closing tag for the greeting. Actually i have a file which contains 500 lines of text with tagging. for. example in that file i have a tag named <to> but it's not closed. I have to insert the closing tag. This is an example. Thanks for your suggestion.