The script may not be executable by the server (check permissions to see if it's world or group executable as relevant) or the location may not be valid for executables. Some servers only allow /cgi-bin/ or other specific(or specified) directories to contain executables. I see that as the likely problem if it works at the command line.
Remember, the web server usually runs as a user of no importance, so unless it shares a group with your script, the script must be world executable.
in reply to Using a perl script as a graphic?