http://www.perlmonks.org?node_id=1230489


in reply to Re^4: Importing constans and variables when "require"ing
in thread Importing constans and variables when "require"ing

used only once doesn't refer to useing, more to using/defining by "mentioning" it. And since you only require XYZ (the module but not the variable XYZ::PI), you are mentioning XYZ::PI only once. The compilation of XYZ.pm, where XYZ::PI is defined, happens only later, during runtime of example.pl , when the require ist actually executed. If you use XYZ instead, Perl sees the declaration of XYZ::PI early enough to avoid the warning.