That's the idea of "defs.pl".  It is supposed to define all the globals
you'll need.   Much like a #include in C.  I've done it before in Perl, but
I wasn't using -w/use strict.  I'm forcing myself to do things the right
way, but keep running in to fundamentals I should have learned years ago.

Thanks.

> -----Original Message-----
> From: dan radom [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, November 08, 2001 9:50 AM
> To: '[EMAIL PROTECTED]'
> Subject: Re: Defining Global Variables w/use strict;
> 
> 
> just a thought, but how can you print a variable that hasn't 
> been defined yet?
> 
> dan
> 
> * Tomasi, Chuck ([EMAIL PROTECTED]) wrote:
> > System: Sun Ultra 2, Solaris 7 (11/99)
> > Perl: 5.6.0
> > 
> > I have a series of related programs that need global 
> definitions ($DOMAIN,
> > $ADMIN, $DBNAME, etc).  My code looks something like this:
> > 
> > ----------<g.pl>----------------
> > #!/usr/local/bin/perl -w
> > 
> > use strict;
> > use DBI;
> > 
> > require "defs.pl";
> > 
> > print "Welcome to $DOMAIN, $ADMIN\n";
> > 
> > 
> > ------------<defs.pl>------------
> > #!/usr/local/bin/perl -w
> >                         
> > use strict;             
> >                         
> > my $DOMAIN="plexus.com";
> > my $ADMIN="Chuck";
> > 
> > --------------------------------
> > 
> > Of course, when I run g.pl I get the infamous,
> > 
> > Global symbol "$DOMAIN" requires explicit package name at 
> ./g.pl line 7.
> > Global symbol "$ADMIN" requires explicit package name at 
> ./g.pl line 7. 
> > Execution of ./g.pl aborted due to compilation errors.
> > 
> > I've tried "my" and "local", but local just changes the 
> error to complain
> > about an explicit package being required.  I'm missing 
> something basic.
> > 
> > How can I define these variables to be known in g.pl, h.pl, 
> and other
> > programs that require defs.pl?
> > 
> > -- 
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to