programming-examples/perl/Subroutine/Local variable shadows the gloabl variable.pl
2019-11-15 12:59:38 +01:00

12 lines
144 B
Perl

$value = 1;
sub printem() {print "\$value = $value\n"};
sub makelocal()
{
local $value = 2;
printem;
}
makelocal;
printem;