in reply to Using variables within packages

From what I can gather script.cgi requires variables.pl and package.pl. If this is the case I think you may want to use 'our'.

In variables.pl you would use
our $Path = '/path/to/datafiles';
In package.pl would just have
our $Path;
package.pl should then see the variable $Path that was defined in variables.pl.

Replies are listed 'Best First'.
Re: Re: Using variables within packages
by floyd (Acolyte) on May 07, 2003 at 17:08 UTC
    I was under the impression that our is from v5.6.0? What would happen if someone was running an older version?

    Floyd

      Have you tried
      use vars qw( $Path );
      Putting this in variables.pl and package.pl should allow you to use the variable $Path in both scripts with older versions of perl.
        No, but I will give it a try.

        Thanks
        Floyd