Local variable shadows the gloabl variable : Local « Subroutine « Perl






Local variable shadows the gloabl variable

   

$value = 1;

sub printem() {print "\$value = $value\n"};

sub makelocal()
{
    local $value = 2;
    printem;
}

makelocal;
printem;

   
    
    
  








Related examples in the same category

1.Local variable shadows the global variable in a subroutine
2.Local variables in subroutines
3.Difference between my and local
4.Duplicate global and local variable name (use strict;)
5.Using local