in reply to Re: Trying to create a common "variable library"
in thread Trying to create a common "variable library"

Use do rather than require (via use) when the "module" doesn't have a package statement.

Replies are listed 'Best First'.
Re^3: Trying to create a common "variable library"
by almut (Canon) on Jul 21, 2010 at 05:22 UTC

    It's maybe worth noting that the do would need to be put in a BEGIN block to have it execute at compile time

    BEGIN { do "MyVars.pm" }

    And for anyone unsure what the difference is:  in contrast to require, do doesn't keep track of what's already been loaded — which could make a difference if you use MyVars several times (in different namespaces) in the same script/program.