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

pq
 2005-11-20 20:05
#55912 #55912
User since
2003-08-04
12209 Artikel
Admin1
[Homepage]
user image
globale variablen sind nicht generell schlecht, aber man sollte sie vermeiden.
ich mache gerne sowas:
Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
package MyConf;
use strict;
use warnings;
use vars qw($Conf @EXPORT_OK);
use base 'Exporter';
@EXPORT_OK = qw($Conf);

# erstelle $Conf
...

#script:
use MyConf '$Conf';
# mach was mit $Conf
Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live. -- Damian Conway in "Perl Best Practices"
lesen: Wiki:Wie frage ich & perlintro Wiki:brian's Leitfaden für jedes Perl-Problem

View full thread lokale Variable aus Sub ins Hauptprogramm!