My most common use of local deals with recursive method calls:
sub foo { my $self = shift; local $self->{some_val} = $self->get_val; # do a bunch of stuff $self->foo; }
This seems strange, but I do find this useful at times. It allows me to temporarily overwrite a value which needs to be preserved for a given stack frame.
Cheers,
Ovid
New address of my CGI Course.
In reply to Re: An eighth use of local
by Ovid
in thread An eighth use of local
by rinceWind
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |