On Tue, May 15, 2012 at 10:37:58AM -0700, Jim Avera wrote: > 'use strict' does not catch undeclared variables in the newer ${^NAME} > syntax. > > For example ${^BOGUS} and ${^_BOGUS} are silently accepted. > > #!/usr/bin/perl > use strict; use warnings; > > for my $varname ('BOGUS', '{BOGUS}', '{^_BOGUS}', '{^BOGUS}') { > my $stmt = "my \$x = \$$varname;"; > eval $stmt; > print $@; > if ($@) { > print "Compile error: $stmt\n"; > } else { > print "NO error: $stmt\n"; > } > } Variables that begin with ^ are special to perl, and reserved. You shouldn't be using them in your own code anyway. They are like punctuation variables in that they are always global, and always reference the variable in the main:: package. For instance: package Foo; $BAR = 1; package Bar; say $BAR ? "yes" : "no"; prints "no", while package Foo; ${^BAR} = 1; package Bar; say ${^BAR} ? "yes" : "no"; prints "yes". This is all by design. 'strict' doesn't catch accesses like this for the same reason that it doesn't catch accesses to things like $@. -doyThread Previous | Thread Next