Produces:use strict; use warnings; { # Outer block my $keeps_value = 0; sub mysub { print "$keeps_value\n"; $keeps_value++ } } # End of outer block mysub(); mysub(); mysub();
The varibale $keeps_value is not visible outside the block.0 1 2
In reply to Re: my variables in a subroutine
by cdarke
in thread my variables in a subroutine
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |