I'm a newbie to this site and I wasn't sure whether to post this in this category or debuggin. I'm running Perl 5.6 on a Linux box running Apache. So I created this test script:
#!/usr/bin/perl use CGI; require "../common.sub"; use CGI::Carp qw(fatalsToBrowser); print "Content-type: text/html\n\n"; print "Hello World";
and it wouldn't work on the web. I checked the server error logs and it said something about premature end of script. However when I ran it from the command line, it worked just fine. I searched the Perl forum cuz I knew something like this was probably common. I found out that if I put the "-w" option with the shebang line, it works fine on the web. So I have two questions. Why is that? And what do I need to do so that I don't have to use -w? You see I'm moving my site from a Win NT computer to a Linux cluster. I never had to use the -w on the Windows computer, but now I do. I thought Perl on Windows is the same as Perl on Linux. I don't want to have to go back through all my scripts and add in -w just so it would work. So how can I make it work without "-w"? I've asked this question and two other forums and people still haven't been able to figure out why this happens. Thanks for your help.

In reply to Don't want to have to use -w by Benahimvp

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.