in reply to Re^2: What does '::' mean in constructs '$::foo' and '@::foo'?
in thread What does '::' mean in constructs '$::foo' and '@::foo'?
No. Assuming the purpose is to "defeat" use strict;, it was made obsolete by use vars qw( @foo );.
perl -e' use strict; @foo = 123; print "ok\n"; ' Global symbol "@foo" requires explicit package name at -e line 3. Execution of -e aborted due to compilation errors. $ perl -e' use strict; use vars qw( @foo ); @foo = 123; print "ok\n"; ' ok
But since strict was introduced in Perl 5.000 and vars was introduced in Perl 5.002, it's safe to say that was not the book's reason for using @::foo.
In fact, it's not obsolete. You still need to use fully qualified names to refer to variables in namespaces other than the current one.
use Data::Dumper qw( Dumper ); local $Data::Dumper::Useqq = 1; local $Data::Dumper::Sortkeys = 1; print(Dumper($data));
|
|---|