There's a couple of possible problems here that come up due to the security issues involved in running setuid scripts. I mean binary executables. So if you had a C program that you compiled and ran as a CGI program, setuid should work as long as the program worked before. With scripts, there's a couple things to watch out for. In most UNIX kernels there exists what is called a 'race condition' when executing scripts.
Scripts are pieces of code which are interpreted by, strangely enough, interpreters.
Common examples of interpreters are perl, sed, and awk. Between the time that the perl interpreter starts executing and the time that it reads in your script the 'race condition' exists. At this time, a mischievous person could 'win the race' and be able to replace your script with another. So their script could do anything that you could do from the command line. As a result, most UNIX kernels will disable users from running scripts as setuid.