Sounds to me like you want
$vars{$_} = HTML::Entities::encode_entities($vars{$_}, '<>&"');
Quote HTML::Entities,
The default set of characters to encode are control chars, high-bit chars, and the <, &, >, ' and " characters. But this, for example, would encode just the <, &, > and " characters:
$encoded = encode_entities($input, '<>&"');
It converts plain text into tag-less HTML.
In reply to Re: Preventing XSS
by ikegami
in thread Preventing XSS
by techcode
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |