SPUG: geting variables from a 'required' file

Dan Ebert mathin at mathin.com
Mon May 14 15:07:18 CDT 2001


I am wanting to set some global variables in a required file (so I can use
different values on different servers without editing the main script
code.)  This code works fine with perl 5.6:

use strict;

our ($var1,$var2);
require 'vars.pl';

print $var1, "\t", $var2, "\n";

but not with 5.005 and if I use 'my' instead of 'our' the values of $var1
and $var2 are NULL.  Is there a way (with 5.005) to declare the variables
so this will work and 'use strict' won't complain?

Thanks!

Dan.
-----------------------------------------------------------
Optimists:  the glass is half full.
Pessimists: the glass is half empty.
Engineers:  the glass is twice as big as it needs to be.
-----------------------------------------------------------







 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     POST TO: spug-list at pm.org       PROBLEMS: owner-spug-list at pm.org
      Subscriptions; Email to majordomo at pm.org:  ACTION  LIST  EMAIL
  Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address
 For daily traffic, use spug-list for LIST ;  for weekly, spug-list-digest
  Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/





More information about the spug-list mailing list