On Tue, Apr 28, 2009 at 06:36, Dermot <paik...@googlemail.com> wrote: > Hi, > > I saw some code like this today: > > > !/bin/perl -w > > package My::Package; > > use strict; > ... > %My::Package::somehash = ( keyone => 'val', keytwo => 'val2'); > > > > The My::Package::somehash isn't declared as with `my` yet the package > loads without error or warnings. Is this because the hash is given as > a fully qualified name or is there some other magic going on? snip
Fully qualified names do not trip strict. Which is a reason to avoid using them. I once work at a place that wrote Perl 5 as if it were still Perl 4. They had turned on strict because they had heard it was the right thing to do, but their response to it failing their scripts was to move to using only fully qualified variables. Now they had even longer variables with an even greater chance of typos: #!/usr/bin/perl use strict; use warnings; $main::x = 5; print "$Main::x\n"; -- Chas. Owens wonkden.net The most important skill a programmer can have is the ability to read. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/