Hallo,
ich habe nach wie vor Probleme mit dem global/local.
In dem folgenden Script kommt nachfolgende Fehlermeldung für die Zeilen 29, 30, 36 und 37.
Global symbol "$test_string" requires explicit package name at .........
Warum kommt die Meldung an diesen Stellen ?
Und warum dann nicht an den Zeilen 23,26,27,34, wo auch $test_string angesprochen wird ?
1 use strict;
2 use CGI qw/:standard/;
3 use CGI::Carp qw(fatalsToBrowser);
....
20 sub test
21 {
22 my @test_string;
23 $test_string [0] = $_[0];
24 if ($_[0] =~ /\s/)
25 {
26 $test_string [1] = $_[0];
27 $test_string [1] =~ s/\s|\xE4/ /g;
28 print "Content-type: text/html\n\n";
29 print "<br>if $test_string [0]: $test_string [0]";
30 print "<br>$test_string [1]: $test_string [1]";
31 }
32 else
33 {
34 $test_string [1] = "";
35 print "Content-type: text/html\n\n";
36 print "<br>else $test_string [0]: $test_string [0]";
37 print "<br>$test_string [1]: $test_string [1]";
38
39 }
40 return (@test_string);
41 }