in reply to textarea output
Take a look at populating a textarea
You may also want to check out some alternatives to CGI.pm for generating HTML documents such as HTML::Template. Then again, you may not :).