in reply to Anti-snippet (or, "local" considered dangerous to fools")
Indeed. Reserve the use of local for Perl
built-in vars, for example:
This "temporarily" undefines $/ so that the entire file handle is read into a scalar without resorting to appending inside a while loop.my $file_contents_as_scalar = do{local $/;<FILEHANDLE>};
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:
You did store your objects in a container didn't you? ;)$_->{field} = $var for @object;
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)
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: Anti-snippet (or, "local" considered dangerous to fools")
by Juerd (Abbot) on Aug 06, 2003 at 17:29 UTC | |
Re: Re: Anti-snippet (or, "local" considered dangerous to fools")
by Mur (Pilgrim) on Aug 08, 2003 at 16:05 UTC |
In Section
Cool Uses for Perl