Sample code for 30+ languages & platforms
Perl

Convert HTML to plain-text

See more HTML-to-XML/Text Examples

Demonstrates how to convert HTML to plain-text.

Chilkat Perl Downloads

Perl
use strict;
use warnings;
use Chilkat2;

# This example assumes the Chilkat API to have been previously unlocked.
# See Global Unlock Sample for sample code.

my $h2t = Chilkat2::HtmlToText->new;

# Set the HTML:
my $html = '<html><body><p>This is a test.</p><blockquote>Here is text within a blockquote</blockquote></body></html>';

my $plainText = $h2t->ToText($html);

print $plainText, "\n";

# The output looks like this:

# This is a test.
#
#     Here is text within a blockquote