http://qs1969.pair.com?node_id=26720

Yohimbe has asked for the wisdom of the Perl Monks concerning the following question:

Given an online commenting system similar to the monastery, and desiring flexibility, with security. I need a small that can take a snippet of html code and allow ONLY a short list of "approved" tags, ie, character formatting and linking only but no tables or blockquotes or javascript.
What I'm talking about starts with something like this:
sub cleanhtml ($) { my $dirty_html=shift; my @allowed_tags=qw(A B BR P I CODE PRE); and ends with: return $safe_html; }