"always passes by reference"

Martijn Faassen m.faassen at vet.uu.nl
Tue Aug 1 17:29:18 EDT 2000


Steven E. Harris <sharris at nospam.primus.com> wrote:
> m.faassen at vet.uu.nl (Martijn Faassen) writes:

>> Hm, I didn't work Perl worked like that without explicit dereferencing,
>> but what do I know about Perl. :)

> [...]

> It acts like that for scalar variables passed to a function. Other
> types like lists and hashes get "flattened out." The habit of passing
> variables by explicit, "hard" reference that you may be recalling is
> necessary when you need to preserve individual list structure over
> several arguments.
[snip]
> To summarize: In Perl, function parameters are always passed "by
> reference," but these are not the same as variable references created
> by the '\' operator or anonymous hash or list constructors.

I'm trying to get my head wrapped around it all now, and I think I might
get the idea (though not remember the details :). Seems quite a lot more
complicated than Python, or even C.. Though I understand this kind of
modification isn't supposed to happen often in actual Perl code.

Thanks for the explanation!

Regards,

Martijn
-- 
History of the 20th Century: WW1, WW2, WW3?
No, WWW -- Could we be going in the right direction?



More information about the Python-list mailing list