in reply to Re: variable passing....
in thread variable passing....

Stop that train! Perl has global variables. What you may be thinking is that each package global exists in its own namespace, so $foo in package Foo is a distinct entity from $foo in package Bar. But all that means is that while you're in package Bar, $foo refers to $Bar::foo. A variable declared in a package (with use vars or, in 5.6, our) is global within that package (e.g. every subroutine in that package can see and modify that variable (unless it's masked by a my declaration -- i.e. within a block (or, if used outside of a block, a file), use of $foo will refer to the variable declared with my $foo)

You may have been thinking that under use strict 'vars', you need to declare variables with my before you can refer to them, but that's not really true (e.g. you can use vars -- for the skinny, see strict (even better the man page on your system) or tye's writeup strict.pm)

Philosophy can be made out of anything. Or less -- Jerry A. Fodor

Replies are listed 'Best First'.
Re: Re: Re: variable passing....
by repson (Chaplain) on Dec 12, 2000 at 04:10 UTC
    I'm aware that perl has locally global variables.
    However I thought the poster referred to globals in VB, which as I recall if declared in a module can be package globals in all packages simultaneously. However my recall may be incorrect since I have seen the light of the holy Perl and left icky VB behind (in other words I haven't used it for a while). Any way this would mean that one instance of the global var $foo is accessible in all packages without using a fully qualified name. This can be useful for a very common function, status variable or a useful constant. However perl does not have global globals and that is the question I was answering.