|XP is just a number|
Can you create *real* global variables?by broquaint (Abbot)
|on Jan 25, 2002 at 01:00 UTC||Need Help??|
broquaint has asked for the wisdom of the Perl Monks concerning the following question:
At some point in the past couple of days of hacking and pondering perl I came across an interesting quandry - is it possible to create a truly *global* variable? While I have no intention of actually doing so I wonder if it's possible.
What I/we know
Thoughts so far
The only global variables that I know of are the one's created by perl, and they tend to be magical (e.g $! yields the current value of errno when in a numerical context, and an error message in a string context). So I'm guessing you can probably roll your own global using some XS voodoo, or some other magical method. I'm almost certain that it's possible as there seems to be very little in perl these days that can't be done (just look at what TheDamian has been producing recently). I also hope that it's not easily possible, as mis-used package variables are bad enough (which why we use strict :o)
Thanks in advance!
footnote: yes I stole this question format from larryk, but only because it's so darn cool!