use strict;
use warnings;
{
my $f = 'test';
my $g = 'test';
sub f {
sub { print "f: $f\n" }->();
}
sub g {
$g if 0;
sub { print "g: $g\n" }->();
}
}
f();
g();
####
>perl589\bin\perl test.pl
Use of uninitialized value in concatenation (.) or string at test.pl line 9.
f:
g: test
>perl5100\bin\perl test.pl
f: test
g: test
##
##
>perl589\bin\perl -wle"{ my $s='test'; sub f { print 's: ', eval '$s' } } f()"
Use of uninitialized value in print at -e line 1.
s:
>perl5100\bin\perl -wle"{ my $s='test'; sub f { print 's: ', eval '$s' } } f()"
Variable "$s" is not available at (eval 1) line 2.
Use of uninitialized value in print at -e line 1.
s: