use strict; use warnings; my $x; $x = 'bar'; BEGIN { print "\$x in first BEGIN block: '$x'\n" } print "runtime: \$x = '$x'\n"; BEGIN { $x = 'foo'; print "\$x in second BEGIN block: '$x'\n"; } print "done.\n"; __END__ Use of uninitialized value $x in concatenation (.) or string at foo.pl line 4. $x in first BEGIN block: '' $x in second BEGIN block: 'foo' runtime: $x = 'bar' done.