Hi, I got a little problem, I made a script that work pretty well in the command line, but when I put it on the server, half the code is printed, and there's no error message.

#################### CGI ###########################

local ($buffer, @pairs, $pair, $name, $value, %FORM); # Read in text $ENV{'REQUEST_METHOD'} =~ tr/a-z/A-Z/; if ($ENV{'REQUEST_METHOD'} eq "GET") { $buffer = $ENV{'QUERY_STRING'}; } # Split information into name/value pairs @pairs = split(/&/, $buffer); foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); $value =~ tr/+/ /; $value =~ s/%(..)/pack("C", hex($1))/eg; $FORM{$name} = $value; } $game = $FORM{game}; $tutorial = $FORM{tutorial}; print "Content-type:text/html\r\n\r\n";

################### Perl ###########################

if (defined($game) && $game !~ m/general|announcement|announcements|do +om3mod|events|finalmap|friends|games|general|hl2mod|pc|recycle|teammo +d|test/) { my $file = "forums/boards/".$game.".txt"; open (my $fh, $file) or die "Can't open $file :$!"; while (defined($line = <$fh>)) { @elements = split(/\|/,$line); print "</var><a href=\"http://www.my-domain.com/tutori +als.pl?tutorial=".$elements[0].">".$elements[1]."<a> Wrote by ".$elem +ents[2]."<br/>"; } }
####################################################

Resume :

I enter a key/value in the browser, if I print the value, it get out fine, if there's no value, the else work fine, but if there's a matching value, it enter the if and it block there. I am guessing it is the while that cause the problem, But I can't find how to fix it, and I don't see why it was working in the command line without error, and not on the server.

The files is at the right location, everything is the same, there's absolutly no error, it just doesn't print anything after the IF, if I entered a matching key/value in the broswer...

Someone could help me? :(


In reply to Running in Terminal, but not on Server by ShaZe

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.