use HTML::Entities; my $ascii = <<'ASCII'; The quick brown fox jumps over the lazy god. ASCII; my $html = encode_entities($ascii); $html =~ s/\r?\n/
/g; print "
$html
";