For Programmers: Free Programming Magazines  


Home > Archive > PERL CGI Beginners > November 2005 > our..









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author our..
Lou Hernsen

2005-11-27, 6:55 pm

ok after reading about "our"

fact:
I use all global vars in the main program.
conclusion
I need to list all the vars in the module as our

in main
my $foo
in mod
our $foo

this will allow the vars to be used by both programs?

Lou

Bob Showalter

2005-11-27, 9:55 pm

Lou Hernsen wrote:
> ok after reading about "our"
>
> fact:
> I use all global vars in the main program.
> conclusion
> I need to list all the vars in the module as our
>
> in main
> my $foo
> in mod
> our $foo
>
> this will allow the vars to be used by both programs?


No.

A variable declared with "my" is only accessible within the enclosing
file, block, or eval.

"our" is a declaration that allows you to use a global (symbol-table)
variable name without a package qualifier when "use strict" is in effect.
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com