I stuck this script in my cgi-bin on my own machine and it worked like a charm! The only change I made was changing open(FILE, ">$localfilename") to open(FILE, ">/tmp/$localfilename"). Here are my system stats:

OpenBSD 2.8 (i386)
perl v5.6.0 built for i386-openbsd
Apache 1.3


And here's the output of your script:
File saved as test (original filename=/home/mosfet/test)

so.... All idiomatic problems aside (like that whole "if" around the regex thing) your script is FINE. There are no relevent bugs in "use strict", which using, by the way, is about the best thing anyone can do in a production environment. If your coworkers give you that whole *@#$! about use strict being only for beginners or what-not, I'm sorry, they're just wrong. use strict is a GOOD IDEA. Unwillingness to use strict can lead to large problems that wouldn't happen in other languages. That's why it's there.

The one reason I can find that your script may not be working is the use of $CGI::SL. On my system it's "/", which is correct for *nix. Since this is determined by the server, it may not change properly for Windows. I can't test this because I don't have access to Windows. But if that's the case, that could be your problem.

PS: Just for kicks I tried it with "use diagnostics" and no errors were produced...


In reply to Works great for me! by osorronophris
in thread Bug in 'strict'?? by Jouke

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.