----- Original Message ----- 
From: "Bob Showalter" <[EMAIL PROTECTED]>
To: "Lou Hernsen" <[EMAIL PROTECTED]>
Cc: <beginners-cgi@perl.org>
Sent: Sunday, November 27, 2005 12:36 PM
Subject: Re: our..


> 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.

File is the entire program.. like a global var?
Block is the "if" or "while" or other {} framed code?
what is an eval? 
if (my $var=0;$var>10;$var++)
is that when you mean? an evaluation?

> 
> "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.
> 

from what you say "our" is used in the main program
so I don't have to declare them again in the mod?
So if I run the mod as one big ad-in program to main
and not calling subs in the mod, I don't have to pass vars in the ()'s?
stats;
and not
stats::sub($var1, $var2, etc....);

this mode only does some calulations and print to the HTML code...


thanks
Lou






-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to