|< 1 2 >| | 12 Einträge, 2 Seiten |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/usr/bin/perl -T
use CGI::Carp qw(fatalsToBrowser);
use strict; # das möchte ich haben
my $conttype = "Content-type: text/html\n\n";
&eins;
&zwei;
sub eins{
my $text = "This is a test!";
}
sub zwei{
print $conttype;
print $text;
}
1
2
3
Software error:
Global symbol "$text" requires explicit package name at C:\Xitami\cgi-bin\mail\test.cgi line 17.
Execution of C:\Xitami\cgi-bin\mail\test.cgi aborted due to compilation errors.
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
########### Read files #################################################
sub read_files{
######### Read inputs file
open(DH, "<$inputs") or die "Cannot open $inputs! $!";
my @fields = <DH>;
close (DH);
######### Read style file
open(DH, "<$style") or die "Cannot open $style! $!";
my $css;
while(<DH>){
$css .= $_;
}
close(DH);
######### Read language file
my %fpmlang;
open(DH, "<$language") or die "Cannot open $language! $!";
my @temp = <DH>;
close(DH);
foreach(@temp){
chomp $_;
my @pair = split(/<==>/, $_);
$fpmlang{$pair[0]} = $pair[1];
}
######### Read skin file
my %fpmskin;
open(DH, "<$skin") or die "Cannot open $skin! $!";
my @temp = <DH>;
close(DH);
foreach(@temp){
chomp $_;
my @pair = split(/<==>/, $_);
$fpmskin{$pair[0]} = $pair[1];
}
######### Read secure file
open(DH, "<$secure") or die "Cannot open $secure! $!";
close(DH);
######### Read config file
my %fpmconfig;
open(DH, "<$config") or die "Cannot open $config! $!";
my @temp = <DH>;
close(DH);
foreach(@temp){
chomp $_;
my @pair = split(/<==>/, $_);
$fpmconfig{$pair[0]} = $pair[1];
}
}
########### Form #######################################################
sub form{
&read_files;
print $conttype;
print @fields;
print $fpmconfig{'BLABLA'};
print $fpmskin{'BLABLA'};
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use strict;
use warnings;
my $globalvar='';
sub in
{
$globalvar='Hallo';
}
soub out
{
print $globalvar;
}
in();
out();
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
sub in
{
my $skalar=hallo;
my @array=(1,2,3);
my %hash=(a=>2,b=>3);
return (\$skalar,\@array,\%hash);
}
sub out
{
print $$_[0];
print "$_\n" for @$_[1];
print "$_=>$_[2]->{$_}\n" for keys %$_[2]:
}
my @refs=in();
out(@refs);
|< 1 2 >| | 12 Einträge, 2 Seiten |