But now I want to run the script from a cgi script as part of the processing by a web service. No matter what the name of the file that was originally uploaded, the web server has homogenized it to a local temporary file whose name is generated by a hash function from the pid. The cgi script passes this arbitrary file name to the script in $1, but of course at this point it does not end in ".pdb" and in fact has no extension at all.
This may be a stupid question, but why not change the upload cgi script to write to $hash.pdb, instead of $hash?
Pete