You already start all your Perl programs with the following line, dont you?
#!/usr/bin/perl -wT
The -T flag enables taint mode in your scripts, which helps you find possible security holes.
This is strongly recommended, especially in CGI scripts.
Read about all the details:
perldoc perlsec
Three simple tools which may help you to debug problems related to tainted data: