On Nov 8, Tomasi, Chuck said: >I have a series of related programs that need global definitions ($DOMAIN, >$ADMIN, $DBNAME, etc). My code looks something like this:
Global variables aren't declared with my(). It sounds like you want to use the Exporter module. Your base program remains the same: use DBI; use strict; require "defs.pl"; print "Welcome to $DOMAIN, $ADMIN\n"; But defs.pl changes a bit: package Defaults; require Exporter; @ISA = 'Exporter'; @EXPORT = qw( $DOMAIN $ADMIN ); $DOMAIN = "..."; $ADMIN = "..."; Defaults->import; 1; That works. However, you might want to take the full-fledged module approach. Your main program will then do use Defaults; instead of require "defs.pl"; And your defs.pl file should be renamed Defaults.pm. The contents will be almost exactly the same, except you should remove the call to Defaults->import. -- Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/ ** Look for "Regular Expressions in Perl" published by Manning, in 2002 ** -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
