in reply to syntax/operator question

$::foo always refers to $main::foo, while $foo is the package variable $Namespace::foo for whatever your current namespace is. They may be identical, but not always.

Perl always sees a variable name containing '::' as a fully qualified name.

After Compline,
Zaxo

Replies are listed 'Best First'.
Re^2: syntax/operator question
by ysth (Canon) on Oct 05, 2004 at 08:05 UTC
    Even without a lexical $foo, and in package main, $foo may differ from $::foo:
    $ perl -we'package Foo; our $foo = 1; package main; $main::foo = 2; print "\$foo: $foo \$::foo $::foo\n"' $foo: 1 $::foo 2