develooper Front page | perl.perl6.language | Postings from February 2001

Re: JWZ on s/Java/Perl/

Russ Allbery
February 9, 2001 20:21
Re: JWZ on s/Java/Perl/
Message ID:
Mark Koopman <> writes:
>> On Fri, 09 Feb 2001 12:06:12 -0500, Ken Fox wrote:

>> That may work for C, but not for Perl.
>> 	sub test {
>> 	    my($foo, $bar, %baz);
>> 	    ...
>> 	    return \%baz;
>> 	}

> 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?

That's a pretty fundamental aspect of the Perl language; I use that sort
of construct all over the place.  We don't want to turn Perl into C, where
if you want to return anything non-trivial without allocation you have to
pass in somewhere to put it.

Russ Allbery (             <> Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About