in reply to close end tag

I am not sure what you are ultimately trying to accomplish but you may want to consider a module like HTML::Scrubber to clean up your HTML.

Replies are listed 'Best First'.
A reply falls below the community's threshold of quality. You may see it by logging in.