in reply to 500 server error with no explenation

Others have pointed out the usefullness of CGI::Carp so you can see some errors that would otherwise be sent to the error log, such as those generated by your dies (update: and your typo as pointed out by eejack, which fortunately prevents the next paragraph from yet being a problem.) (And the error log is a good place to check.)

That said, your code has a very serious security flaw -- you do not untaint $name and $name2, allowing a string like ;rm -rf / | to be passed to it, resulting in your CGI deleting every file on the server that it can. Or worse is possible. You might be better off somehow encoding filenames of users so that special characters won't be so much of a problem.

You aren't using warnings and strict which is a very good idea. Please do so. And for your CGI script, turning on taint checking is also a good idea.

Also, the CGI module has a header method. Why not use it?

Your script, as shown here, outputs malformed HTML. Best to add a print to close those tags.