CGI/Perl Taint Mode FAQ
To untaint a variable, you use regular expressions. The only way to untaint a variable is to do a regular expression match using groups inside the regular expression pattern match. In Perl, the first group match gets assigned to $1, the second group to $2...