#!/usr/bin/perl -w my $text = "c:/text.pl"; open TEXT, $text or die "Oops can't open $text $!"; open HTML, ">$text.htm" or die "Oops can't write $text.htm $!"; print HTML "
\n";
while () {
    $_ = escapeHTML($_);
    print HTML $_;
}
print HTML "
\n"; close HTML; close TEXT; sub escapeHTML { local $_ = shift; # make the required escapes s/&/&/g; s/"/"/g; s//>/g; # make the whitespace escapes - not required within pre tags s/\t/    /g; s/( {2,})/" " x length $1/eg; # make the brower bugfix escapes; s/\x8b/‹/g; s/\x9b/›/g; # make the PERL MONKS escapes (if desired) s/\[/[/g; s/\]/]/g; # change newlines to
if desired # s/\n/
/g; return $_; }