What is PHP strip_tags() Perl quivalent?



Like the previous PHP Strip_tags() javascript equivalent question, I am looking for PHP strip_tags() Perl equivalent? I have to stip all html tags from content in Perl.



Use Perl's CPAN Strip module as indicated below:

HTML::Strip - Perl extension for stripping HTML markup from text.

 use HTML::Strip;
 
  my $hs = HTML::Strip->new();
 
  my $clean_text = $hs->parse( $raw_html );
  $hs->eof;

CPAN strip module has the limitation that despite only outputting one space character per group of tags, and avoiding doing so when tags are bordered by spaces or the start or end of strings, HTML::Strip can often output more than desired; such as with the following HTML:

     <h1> HTML::Strip </h1> <p> <em> <strong> fast, and brutal </strong> </em> </p>

This gives the following output:
     HTML::Strip    fast, and brutal   

Thus, you may want to post-filter the output of HTML::Strip to remove excess whitespace (for example, using tr/ / /s;). (This has been improved since previous releases, but is still an issue)