Stephan: Fehler in Script, komische Fehlermeldung

Beitrag lesen

Hallo,

es geht nicht, jetzt ist zwar der Syntax OK, der Rest aber nicht mehr:

Useless use of a constant in void context at
 /home/www/web1027/html/service-partner/billig-urlauber/redirect.cgi line 56 (#1)
    (W void) You did something without a side effect in a context that does
    nothing with the return value, such as a statement that doesn't return a
    value from a block, or the left side of a scalar comma operator.  Very
    often this points not to stupidity on your part, but a failure of Perl
    to parse your program the way you thought it would.  For example, you'd
    get this if you mixed up your C precedence with Python precedence and
    said

$one, $two = 1, 2;

when you meant to say

($one, $two) = (1, 2);

Another common error is to use ordinary parentheses to construct a list
    reference when you should be using square or curly brackets, for
    example, if you say

$array = (1,2);

when you should have said

$array = [1,2];

The square brackets explicitly turn a list value into a scalar value,
    while parentheses do not.  So when a parenthesized list is evaluated in
    a scalar context, the comma is treated like C's comma operator, which
    throws away the left argument, which is not what you want.  See
    perlref for more on this.

/home/www/web1027/html/service-partner/billig-urlauber/redirect.cgi syntax OK

und der Code

#!/usr/bin/perl
use diagnostics;
################
$db = '/home/www/web1027/html/service-partner/outbound-clicks.db';
$useflock='yes';
$flocklock='2';
$flockunlock='8';

####################

$url=$ENV{'QUERY_STRING'};

####      Form Variables     ####

if ($url)
{
   open(DATA,"$db");
   @lines=<DATA>;
   close(DATA);
   open(DATA,">$db");
   if ($useflock eq 'yes'){flock DATA, $flocklock;}
   foreach $line (@lines)
   {
      ($URL, $count) = split(/|/,$line);
      if ($URL eq $url)
      {
         $count++;
         print DATA ("$URL|$count\n");$old="yes";
      }
      else
      {
         print DATA $line;
      }
   }
   if ($useflock eq 'yes'){flock DATA, $flockunlock;}
   unless ($old)
   {
      print DATA "$url|1\n";
   }
   close(DATA);
   print "Location: $url\n\n";
   exit;
}
else
{
   print "Content-type: text/html\n\n";
   print <<EOM;
<center>

Nowhere To Redirect To!! <a href="http://www.billig-urlauber.de">Back To Billig-Urlauber.de</a>

EOM

exit;
}
(EOF)

Ich bin am Verzweifeln!