programming-examples/perl/Subroutine/Local variable shadows the gloabl variable.pl

12 lines
144 B
Perl
Raw Normal View History

2019-11-15 12:59:38 +01:00
$value = 1;
sub printem() {print "\$value = $value\n"};
sub makelocal()
{
local $value = 2;
printem;
}
makelocal;
printem;