To repair the .cgi file you will need to log into your account using SSH with a program like PuTTY.
Once logged in you should run:-
pico -w filename.cgi
Then add a space or character somewhere, say at the end, then remove the same space or character. (This ensures the file is modified).
Now save and exit with:-
and assuming you have created an executable .cgi as mentioned in previous replies the file should run okay.
Opinions are my own views, not DreamHosts'.
I am NOT a DreamHost employee OK!! :@
You act on my advice at your own risk!