On Tue, 2008-12-02 at 16:42 +0100, Martin Barth wrote:
> Hello,
> 
> whats the difference if you start a variable with ::
> 
> for example:
> 
> $::a
> $a
> $main::a
> 
> or:
> 
> Package Foo;
> $::a # <- this is still main?!

Yes, the is a shortcut for $main::a

> 
> $::Foo::a

This is a shortcut for $main::Foo::a

> $Foo::a 
> $a
> 
> didn't found information in the perldoc.

A variable with :: in it, or for that matter any thingy like a
subroutine, is called a fully-qualified name.  It does not need to be
declared with an 'our' or 'use vars'.

Note that these variables are not the same as lexically-scoped ones.
Variables declared with 'my' are lexically scoped and cannot be accessed
using this nomenclature.


-- 
Just my 0.00000002 million dollars worth,
  Shawn

The key to success is being too stupid to realize you can fail.


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


Reply via email to