Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^7: Importing constans and variables when "require"ing

by soonix (Abbot)
on Feb 24, 2019 at 18:16 UTC ( #1230499=note: print w/replies, xml ) Need Help??


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

Yes, but be aware that $main::x is a global variable (as in the first error message), which means it can be accessed and modified from anywhere, even outside the corresponding module. So, if once upon a time its value differs from what you expect, you'll have a huge space to search for the culprit.

OTOH, if you use scoped (i.e. my) variables, you'll need to search only the correspondig scope.

The error message
Global symbol "$x" requires explicit package name
actually means
Do you really want "$x" to be a global symbol?

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1230499]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (5)
As of 2019-05-21 11:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you enjoy 3D movies?



    Results (132 votes). Check out past polls.

    Notices?
    • (Sep 10, 2018 at 22:53 UTC) Welcome new users!