You have your answers below, but I'd thought I'd post a simple example, which shows quite explictly that the 'my' does scope a variable, but doesn't re-initialise it if you have a conditional which evaluates to false.
print count() . "\n"; print count() . "\n"; print count() . "\n"; sub count { my $counter = 'whatever' if 0; # declare local 'static' variable $counter++; } __OUTPUT__ 0 1 2
PS. Don't actually do this though
In reply to Re^3: 'my' problems
by reasonablekeith
in thread 'my' problems
by jockel
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |