in reply to Globals with Strict

You have three options

  1. the vars pragma to declare package level variables
  2. available in perl5.6+, our which declares a package level and also creates lexical variable aliased to the package variable
  3. fully qualify the variables with their package name

Which you can implement like so

use vars '$config'; our $config; $Your::Package::config;

HTH

_________
broquaint

Replies are listed 'Best First'.
Re: Re: Globals with Strict
by dragonchild (Archbishop) on Sep 12, 2003 at 15:51 UTC
    File-scoped lexicals are globally-scoped to anything in that file. our is only really useful when dealing with application-globals - things that will be used in more than one file. (@ISA, @EXPORT_OK, and $VERSION come to mind.) That's the reason why my is singularly possessive and our is plurally possessive. I personally think that our is misused in 99% of its usage.

    ------
    We are the carpenters and bricklayers of the Information Age.

    The idea is a little like C++ templates, except not quite so brain-meltingly complicated. -- TheDamian, Exegesis 6

    Please remember that I'm crufty and crochety. All opinions are purely mine and all code is untested, unless otherwise specified.