The deletion of <br> is no different than the deletion of the paragraph tags. Even the doc for the module (HTML::TreeBuilder) mentioned in your description of your problem (See ' ...and NOT just BTW') tells you quite plainly where to find the answer to this question:
...The methods inherited from HTML::Parser are used forbuilding the HTML tree, and the methods inherited from HTML::Element are what you use to scrutinize the tree. Besides this (HTML::TreeBuilder) documentation, you must also carefully read the HTML::Element documentation, and also skim the HTML::Parser documentation -- probably only its parse and parse_file methods are of interest.

Loosely put (in the context of your question and of HTML::Element and HTML::Parser), since <br> is NOT "as_text" - it's html - neither it nor any substitute appears the output:

$h->as_text(skip_dels => 1)
Returns a string consisting of only the text parts of the element's descendants. (Emphasis supplied)

...and NOT just BTW,
you've offered no code and your narrative cites a different module (HTML::TreeBuilder) than your title (HTML::Element). Those shortcomings make offering help more difficult than necessary.

Edited: removed irrelevant detail from the second quote from the docs; emphasized the relevant part.


In reply to Re: HTML::Element and "<br>" tags by ww
in thread HTML::Element and "<br>" tags by trashtalker

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.