in reply to Re^2: Importing constans and variables when "require"ing
in thread Importing constans and variables when "require"ing
Strict has 3 effects, one (subs) is to restrict the use of barewords to only known subs. Constants are implemented as subs and need to be known at compile time.
See also "use subs "
This doesn't necessarily mean that the sub known at compile time is also the called sub, because resolution happens at run time. (Keep in mind that you can redefine subs dynamically, this will just update the reference in the symbol table)
Any sub called with & or trailing () is not a bareword anymore, and not effected by strict.
Another effect of strict (vars) is to enforce pre declaration of unqualified variables with my or our.
But your variables are fully qualified. And barewords are not variables (under strict).
It all becomes much easier if you first understand how Perl works without strict, an why these restrictions need to be done.
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
FootballPerl is like chess, only without the dice
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^4: Importing constans and variables when "require"ing
by bliako (Abbot) on Feb 24, 2019 at 12:20 UTC | |
by soonix (Chancellor) on Feb 24, 2019 at 12:47 UTC | |
by bliako (Abbot) on Feb 24, 2019 at 13:09 UTC | |
by soonix (Chancellor) on Feb 24, 2019 at 18:16 UTC | |
by LanX (Saint) on Feb 24, 2019 at 15:09 UTC | |
by Your Mother (Archbishop) on Feb 24, 2019 at 16:42 UTC | |
by bliako (Abbot) on Feb 25, 2019 at 11:39 UTC |