Welcome to WebmasterWorld Guest from 22.214.171.124
The tilde shouldn't be a problem, either.
I'm going to take a wild stab here and guess you are setting up a CGI on a Mac OS X machine in a /Users/[usernmae]/Sites directory. In that case, your problem may be that the CGI is not in a place where your Apache Web server (currently) recognizes it as an executable script. (Am I close?)