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.


In reply to Re: 500 server error with no explenation by wog
in thread 500 server error with no explenation by JBowes

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.