On Fri, 9 Feb 2001 16:14:34 -0800, Mark Koopman wrote:
>but is this an example of the way people SHOULD code, or simply are ABLE to
>code this. are we considering to deprecate this type of bad style, and force
>to a programmer to, in this case, supply a ref to %baz in the arguements to
>this sub?
I think you're trying too hard turning Perl into just another C clone.
Dynamic variable allocation and freeing, like this, are one of the main
selling points for Perl as a language.
Note that %baz can, as values, also contain references to other
lexically scoped varibles, like \$foo and \$bar. No prototping around
that.
>> sub test {
>> my($foo, $bar, %baz);
>> ...
>> return \%baz;
>> }
You could, theoretically, create special versions of "my", or a "my"
with an attribute, so that these declared variables are kept out of the
normal lexical pool, and garbage collected in a more elaborate way,
perhaps even reference counting.
--
Bart.