The advantage of nearly all dynamic languages over C is that it's much harder to get buffer overflows while doing string manipulation, which can easily become a security problem.

Also Perl has libraries that help you dealing with the CGI protocol, and they are battle tested and stable.