in reply to Convert line break: TEXT<br><br> to paragraph: <p>TEXT</p>

As you already know, TEXT<br /><br /> is not the same thing as <p>TEXT</p>. That would be the equivalent of comparing <h2>TEXT</h2> to <b>TEXT</b>.

I'd personally look at how the page you're seeing is constructed, and convert on an as-needed basis. There are many uses for <br />, which do not necessarily convert to <p> directly.

Look into HTML::TokeParser and HTML::TreeBuilder to abstract the text values of those tags and put them inside your nested paragraph tags.

Just be aware that what you're doing is most-likely entirely wrong, but perl will let you do it.