Just another Perl shrine | |
PerlMonks |
Perl keywords for declaring variables: my, our and local???by jira0004 (Monk) |
on Mar 22, 2003 at 18:30 UTC ( [id://245190]=perlquestion: print w/replies, xml ) | Need Help?? |
jira0004 has asked for the wisdom of the Perl Monks concerning the following question: Hi, I do a substantial amount of development work in Perl. Typically, I use the Perl strict module to force the declaration of variables via the use of the Perl keword my . Presently, I am involved in an integration project at work. We are using Perl to integrate several technologies. I have successfully encouraged my development team to use the Perl strict module to force declaration of variables to avoid the various pitfalls associated with the ability to use variables without declaring them, such as misspelling a variable name and having Perl treat it as two different variables instead of two instances of the same variable. One of the members of my team is using the Perl keyword our to declare variables within one of the Perl scripts we are developing. I have never seen the Perl keyword our and so didn't know it could be used to declare variables within a script. What is the Perl keyword our? What is it used for? How is declaring a variable using the keyword our different from declaring a variable using my? Thanks for any helpful replies and input Sincerely, Peter Jirak
Back to
Seekers of Perl Wisdom
|
|