Try writing a recursive function using content_list method of HTML::Element.
For example,
my $html = HTML::TreeBuilder->new_from_content("$text") || die "$@\n"; sub to_text { if (ref $_[0] eq "HTML::Element") { foreach my $sub_element ($_[0]->content_list) { &to_text($sub_element); } } else { print qq{text="$_[0]"}; } } &to_text($html);
In reply to Re: Parsing and converting HTML
by aitap
in thread Parsing and converting HTML
by tevolo
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |