[Linux-disciples] perl question: why do modules return a reference to a hash and not a hash?

Adam Rosi-Kessel adam at rosi-kessel.org
Thu Dec 22 13:55:25 EST 2005


Stephen R Laniel wrote:
> Again, the syntax for initializing hashes is the same as
> that for initializing lists. I'm pretty sure that if you
> rerun your function-that-calls-other-functions with a hash
> as an argument, you'll get the output you expect.

Oops. Yeah. You got me.

So initializing the hash correctly, when values are returned I get:

Parameter 1 = a
Parameter 2 = 1
Parameter 3 = b
Parameter 4 = 2
Parameter 5 = bob

When references are returned I get:

Parameter 1 = HASH(0x8160654)
Parameter 2 = SCALAR(0x8163cd8)

So that is, indeed, at least one good reason to return references.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 250 bytes
Desc: OpenPGP digital signature
Url : http://lists.bostoncoop.net/pipermail/linux-disciples/attachments/20051222/7a9affc5/signature.pgp


More information about the Linux-disciples mailing list