"John D. Leonard II" wrote:
> 
> All:
> 
> I noticed two diffent syntaxes in the previous thread:
> 
> > > # global.asa
> > > my $Var = "first project";
> 
> and
> 
> > > # global.asa
> > > use vars qw( $Var ); # declare globals
> > > $Var = "first project";
> 
> What's the difference?  Which is preferred?
> 

The my() scoping of package global's can be a little complex
so I would stay away from it generally.  A my() scoped
package global is supposed to be invisible from outside the 
package, so is something like a static global in C if my memory 
serves me. ( It almost 4AM, so have little memory now :)
Further, if a my() scoped global is moved to a sub, its no
longer a private package global, its locally scoped in the sub.

So, for globals I would stick with globals, with the use vars qw()
declaration syntax generally, unless you explicitly want to 
privatize something.

--Josh

_________________________________________________________________
Joshua Chamas                           Chamas Enterprises Inc.
NodeWorks Founder                       Huntington Beach, CA  USA 
http://www.nodeworks.com                1-714-625-4051

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to