Do you know where your variables are? | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
I looked at the docs, looked at some threads, delved into the CB, and consulted the magic 8 ball, but I still can't seem to get my head around the answer to: What is the difference between my, use vars, and our? Most answers seemed vague, or I just didn't understand. The most worrysome answer was "Outlook not so good" from the magic 8-ball. I'm an NT admin. I know about Outlook not so good. Tell me about Perl scope, 8-ball. Perl scope! What I think I know:
So on line 4 or 5, before any blocks, I declare my $foo. It acts with a lexical scope of the entire script. It acts sort of like a global variable. What if I put our $foo in the same place. Do I get the same effect? What if I put use vars $foo? My questions:
See this example. Look at %TOC. Should it be my or our? Thanks for your help. In reply to Our, use vars, and magic, oh my! by OzzyOsbourne
|
|