Nested subroutine with local variable : Nested « Subroutine « Perl






Nested subroutine with local variable

   


$value = 1;

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

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

makelocal;
printem;

   
    
    
  








Related examples in the same category

1.Nested method
2.nested subroutine
3.A nested subroutine.