Indeed. Reserve the use of
local for Perl
built-in vars, for example:
my $file_contents_as_scalar = do{local $/;<FILEHANDLE>};
This "temporarily"
undefines
$/ so that
the entire file handle is read into a scalar without
resorting to appending inside a
while loop.
Using local on lexical or package variables can be
dangerous. For your example, surely the better way to assign
that variable to multiple classes is:
$_->{field} = $var for @object;
You did store your objects in a container didn't you? ;)
jeffa
L-LL-L--L-LL-L--L-LL-L--
-R--R-RR-R--R-RR-R--R-RR
B--B--B--B--B--B--B--B--
H---H---H---H---H---H---
(the triplet paradiddle with high-hat)