sub sanitize($) { #* # to remove HTML from a string #* my ($s) = @_; # a string of text my $rv = 0; if ($s) { my $nohtml = HTML::Restrict->new(); my $processed = $nohtml->process($s); if ($processed ne $s) { $rv = $processed; } else { $rv = $s; } } return $rv; #usage: my $sanitized = sanitize($input); }