We don't bite newbies here... much | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Update: can't believe I missed an important point. This is only if these are declared in a seperate block. D'oh.
Mea Culpa. 1.Is there any difference between declaring variables at the beginning of scripts with my or our? Won't their
scope be the same? 1. The scope is the same. our variables cannot be used outside the current file (unless they are declared in the other file of course). In the file there is an important difference though. our variables can be seen in subroutines and my variables declared at the top of your script cannot be seen inside your subroutines. You must pass them in. 2. If you don't want your subs to see the variables without being passed in ( ie as global ) then you should use my. In reply to Re: Our, use vars, and magic, oh my!
by dga
|
|