Thread lokale Variable aus Sub ins Hauptprogramm! (30 answers)
Opened by skontox at 2003-09-24 21:07

root
 2005-11-20 20:38
#55913 #55913
User since
2003-08-15
120 Artikel
BenutzerIn
[default_avatar]
Verstehe ich noch nicht ganz!
Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# Hauptprogramm
#!/usr/bin/perl -w
#package MyConf;
use strict;
use warnings;
use vars qw(%template @EXPORT_OK);
use base 'Exporter';
@EXPORT_OK = qw(%template);
require "rootssubs.sub";

my %template = ("site" => "home");

print "Content-type: text/html\n\n";

&test;
exit(0);


Code: (dl )
1
2
3
4
5
6
# rootssubs.sub
#use MyConf '%template';
sub test{
print "Bin in test:".$template{'site'}."<br>\n";
}
1;


output: Bin in test:

Variable kommt nicht an, strict meckert aber auch nicht.
Die package Nummer hab ich auskommentiert, weil es damit gar nicht läuft. Kann du das bitte mal näher erläutern? Was machen die Zeilen so?

View full thread lokale Variable aus Sub ins Hauptprogramm!