hi all, my script gives the " premature end of script headers " error in server log . i have checked every possible reason as such. the script is not dos formatted , no warnings or error other than end of script headers. dont know where to look . script runs fine on commandline and the location of perl interpreter is correct. here's the script see if you can make out something of it.
#!/user/bin/perl -w BEGIN { $|=1; print "Content-type: text/html\n\n"; use CGI::Carp('fatalsToBrowser'); } use Fcntl; # find the keyword in gutenberg.txt #@gut_results; @gutenbergr = (1..56522); array_shuffle (\@gutenbergr); $filename = 'gutenberg.txt'; open (GUT, "< /home/sid/kwicionary/$filename") or die "Can't open $fil +ename for reading: $!"; $path = "/home/sid/kwicionary/"; $indexname = "$filename.index"; sysopen(IDX,$indexname, O_CREAT|O_RDWR) or die "Can't open $indexname +for read/write:$!"; build_index(*GUT, *IDX) if -z $indexname; $key = $FORM{'search'}; GUT:foreach (@gutenbergr){ print "$#gut_results \n"; $limit = 100; $line_number = $_; $line = line_with_index(*GUT,*IDX,$line_number); if ($key =~ /\*/){ # $key = substr($key,0,(length($key) -1)); @word = split(' ',$line); foreach (@word){ if ($_ =~ /$key/){ push (@gut_results , $_); if ($#gut_results == 100){last GUT;} } } } else { @word = split(' ',$line); foreach (@word){ if ($_ =~ /^$key$/){ push (@gut_results , $_); if ($#gut_results == 100){last GUT;} #print "matched gutenberg '$_' \n"; } } } undef @word; if ($#gut_results eq $limit){last GUT;} } undef @gutenbergr;
all i get in server error log is
Premature end of script headers: search.cgi (2)No such file or directory: exec of '/var/www/cgi-bin/authenticate/s +earch.cgi' failed
also, cannot understand which file the server could not find. I am including none. can somebody help??

In reply to premature end of script headers by fadingjava

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.