Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Variable scope in packages.

by damian1301 (Curate)
on Jun 29, 2001 at 23:50 UTC ( #92788=note: print w/ replies, xml ) Need Help??


in reply to Variable scope in packages.

When you require a script(*.pl), it brings it's variables, subs, and all into your namespace so you can simply access it as %crap. Voila!

NOTE: That if you require a package it will not be the same. It will not be automatically included in your namespace and you would have to make each call explicitly -- Credit goes to Petruchio on the note.

$_.=($=+(6<<1));print(chr(my$a=$_));$^H=$_+$_;$_=$^H; print chr($_-39); # Easy but its ok.


Comment on Re: Variable scope in packages.
Download Code
Re: Re: Variable scope in packages.
by runrig (Abbot) on Jun 29, 2001 at 23:59 UTC
    Note: if you are using strict (in BooYah.pm), and %crap is declared with my in Foo.pl, then you won't be able to access it at all. Heck, you won't even be able to run the program (if you try to access it from BooYah.pm that is) :)

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (10)
As of 2014-07-29 11:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (214 votes), past polls