Thread Syntax-Error (30 answers)
Opened by SirLant at 2003-08-26 20:34

SirLant
 2003-08-26 20:34
#80399 #80399
User since
2003-08-04
516 Artikel
BenutzerIn
[default_avatar]
Habe hier zwei Fehler in meiner Syntax, finde die aber beim besten willen nicht, vllt. könnt ihr mal nen Blick drauf werfen.
Ist in der nähe von Zeile 41 und 64

Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#!e:/programme/perl/bin/perl.exe -w
#gb.cgi - Gästebuch

use strict;
use warnings;
use CGI qw %:standard escape escapeHTML%;
use CGI::Carp qw %fatalsToBrowser%;

my $datei = "gb.txt";
my @seite;
my $aktion = param ("aktion");

print "<html><head><title>Gästebuch</title></head><body>
"; 

if ($aktion eq "") {

        open(FH, "$datei") or die "Fehler beim oeffnen von $datei: $!";
        
        print "<table>";

        if (@seite) {
                for (@seite) {

                        next if $_ eq "####
";
        
                        print "<tr>$_</tr>";

                }
                print "</table><br>";
        }
        else {
        
                print "<h3>Noch keine Einträge vorhanden</h3>";
        
        
        close FH;
        
        print "<div align = \"center\"><a href = \"gb.cgi?aktion=eintrag\">Schreib mir!</a></div>";
        
}
elsif ($aktion eq "eintrag") {

        print "<table><form aktion = \"gb.cgi?aktion=new\" method = \"GET\">";
        print "<tr>";
        print "<td>Name</td>";
        print "<td><input type = \"text\" name = \"name\"></td></tr>";
        print "<tr>";
        print "<td>E-mail</td>";
        print "<td><input type = \"text\" name = \"email\"></td></tr>";
        print "<tr>";
        print "<td>Homepage</td>";
        print "<td><input type = \"text\" name = \"hompage\"></td></tr>";
        print "<tr>";
        print "<td>Wohnort</td>";
        print "<td><input type = \"text\" name = \"wohnort\"></td></tr>";
        print "<tr>";
        print "<td>Nachricht</td>";
        print "<td><textarea name = \"nachricht\"></textarea></td></tr>";
        print "<tr>";
        print "<td><input type = \"submit\" name = \"button\" value = \"eintragen\"></td></tr>";
        print "</table><br>";
        print "<a href = \"gb.cgi\">zurück</a>";

}
elsif ($aktion eq "new") {

        open(FH, "> $datei") or die "Fehler beim oeffnen von $datei: $!";
        
        print <FH> "<td>Name:</td><td>" . param ("name") . "</td>
":
        print <FH> "<td>E-Mail:</td><td>" . param ("email") . "</td>
";
        print <FH> "<td>Homepage:</td><td>" . param ("homepage") . "</td>
";
        print <FH> "<td>Wohnort:</td><td>" . param ("Wohnort") . "</td>
";
        print <FH> "<td>Nachricht:</td><td>" . param ("nachricht") . "</td>
";
        print <Fh> "<td rowspan = \"2\"><hr></td>";
        print <FH> "####
";
        
        close FH;
        
        open(FH, "$datei") or die "Fehler beim oeffnen von $datei: $!";
        
        print "<table>";

        while (<FH>) {

                next if $_ eq "####
";
        
                print "<tr>$_</tr>";

        }
        
        close FH;
        
        print "</table><br>";
        print "<a href = \"gb.cgi?aktion=new\">Schreib mir!</a>";
        
}
        
print "</body></html>";

exit 0;

Zeile 41 ist das elsif ($aktion eq "eintrag") {

und zeile 64 das } über elsif ($aktion eq "new") {


Das GB ist nur ne kleine Aktion aus langeweile, deshalb ist es so simpel :)\n\n

<!--EDIT|SirLant|1061915777-->
--Programming today is a race between Software Enginers striving to build bigger and better idiot-proof Programs,
and the Universe trying to produce bigger and better idiots.
So far, the Universe is winning!

View full thread Syntax-Error