in reply to strict and require.

You'll need to make $footer into a package variable. Add the line

use vars qw($footer);

to the top of vars.pl and remove any my declarations of $footer.

Of course, the best solution would be to make a MyVars.pm module.

Update: Ignore me, robin's right (as usual). I'm talking nonsense. I blame the Euro.

The module idea is still the best way to go tho'.

--
<http://www.dave.org.uk>

"The first rule of Perl club is you do not talk about Perl club."
-- Chip Salzenberg

Replies are listed 'Best First'.
Re: Re: strict and require.
by robin (Chaplain) on Jan 03, 2002 at 00:45 UTC
    I think you really need to add
    use vars qw($footer);
    to your main program. Because strictness is lexically scoped, it won't apply to vars.pl anyway, so it's not a problem there.

    Then you can use the package variable $footer from the main program. Another possibility is to put an explicit package declaration into vars.pl (but don't use package vars; because that name is used by the use vars pragma.)

    package Vars; $footer = qw(...);
    then you can require vars.pl, and refer to the footer as $Vars::footer from your main script.
Re: Re: strict and require.
by Baz (Friar) on Jan 02, 2002 at 22:21 UTC
    Ok, i added the line but this gives my the error
    Global symbol "$footer" requires explicit package...(for the calling function),
    Again when i comment out strict it works.
    Note: my var.pl file contains nothing but the line you suggested and the definition of $footer...and <bold>doesnt</bold> contain the line
    #!/vars/bin/perl -Tw

      Maybe you could show us the code. I find that's a little more precise than vague descriptions :)

      --
      <http://www.dave.org.uk>

      "The first rule of Perl club is you do not talk about Perl club."
      -- Chip Salzenberg