J
Jason Dusek
I have a script with top level variables in it (i.e - variables that
are not declared within a block, function definition or class
definition). When I run this script through irb with load, I can
access the variables just as though I had defined them in irb. Cool!
Then I added a true global variable - $opts - to my script. I run it
through irb and, lo and behold, I can't get at those top level
variables anymore. What happenned? Did declaring the global variable
somehow sink my script into its own context?
are not declared within a block, function definition or class
definition). When I run this script through irb with load, I can
access the variables just as though I had defined them in irb. Cool!
Then I added a true global variable - $opts - to my script. I run it
through irb and, lo and behold, I can't get at those top level
variables anymore. What happenned? Did declaring the global variable
somehow sink my script into its own context?