in reply to how to eliminate all html tags in a given string ??

Take a look at HTML::TreeBuilder and the element method as_text.

use warnings; use strict; use HTML::TreeBuilder; my $string= " <html><head> i am sugar <br> smartest guy in the world < +br> </head></html>"; my $tree = HTML::TreeBuilder->new; $tree->parse ($string); print $tree->as_text ();

Prints:

i am sugar smartest guy in the world

DWIM is Perl's answer to Gödel

Replies are listed 'Best First'.
Re^2: how to eliminate all html tags in a given string ??
by jdporter (Paladin) on Nov 24, 2005 at 17:50 UTC
    print HTML::TreeBuilder->new_from_content( $string )->as_text;