Come for the quick hacks, stay for the epiphanies. | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
So, in answer to question 1: no, it contains a reference (which might be an address of something, but you don't {and shouldn't} need to know what). Got it. Thanks for that clarification! $ in Perl as a sigil means "give me a scalar value". In answer to 2: $$ means give me the scalar referred to by the scalar xxx. Because you can assign values to a scalar when you use $$ in an assignment you are assigning to the scalar referred to by the scalar. No pointers to be seen here. Ok, I think I understand what you are saying. Taking your explanation one step further, I was wondering if I could use a "triple dollar sign" ($$$). Not that this would be idiomatic or anything but apparently you can: which results in
...Perl doesn't need "output parameters" because it can return multiple values from a sub. I didn't know that! That is very cool! References in Perl are most useful in building interesting structures which are a mixture of arrays, hashes and scalar values. I guess I just need to keep re-reading the excellent documentation and trying this out. I implicitly understand the power of references but still struggling with applying them. In reply to Re^2: Pointers and References
by Leudwinus
|
|