in reply to escaping <!-- and --> in substitution...or other help plz

Doesn't the following work?

$content =~ s/&/&amp;/g; $content =~ s/</&lt;/g; $content =~ s/>/&gt;/g; # optional. print("<textarea>$content</textarea>");

To save it:

open(FILE, "> file.html"); print FILE $cgi->param('content'); close(FILE);