use strict; sub foo { $x = 'foo'; # Refers to package var $main::x. # It's also a compilation error. } my $x; foo(); print($x); # foo