http://qs1969.pair.com?node_id=1074638


in reply to Importing variables (not functions) from in-file packages

The error "... requires explicit package name" is a compile time error. It means Perl was not able to find where the variable was declared when compiling the script. Just put all the packages before the main package and everything will work.
لսႽ ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ
  • Comment on Re: Importing variables (not functions) from in-file packages

Replies are listed 'Best First'.
Re^2: Importing variables (not functions) from in-file packages
by puterboy (Scribe) on Feb 12, 2014 at 15:55 UTC
    Thanks. I hadn't realized (and perhaps still don't fully understand) the difference between compile time vs. run time errors for variables and functions. But now that I think of it, I suppose this is consistent with the fact that variables need to be declared ahead of usage (if using strict) while function definitions can follow their usage.

    Is there any analogy to the run-time "BEGIN" to tell the compiler to start (or branch elsewhere)?