- or download this
perl -wMstrict -e "$::x=0; $x++" # not OK
perl -wMstrict -e "package foo; $foo::x=0; $x++" # not OK
- or download this
perl -wMstrict -e "BEGIN{*::x=\$a} $x++" # not OK (1)
perl -wMstrict -e "BEGIN{package foo; *::x=\$a} $x++" # OK (2)
- or download this
perl -wMstrict -e "{package foo; *::x=\$a} $x++" # not OK
- or download this
C:\>perl -MO=Deparse -wMstrict -e "{package foo; *::x=\$a} $x++"
Variable "$x" is not imported at -e line 1.
...
*main::x = \$a;
}
$main::x++;
- or download this
perl -wMstrict -e "BEGIN{package bar; *bar::x=\$a} package bar; $x++"
+ # not OK
perl -wMstrict -e "BEGIN{package foo; *bar::x=\$a} package bar; $x++"
+ # OK