Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Dereferencing

by MCS (Monk)
on Mar 30, 2004 at 14:33 UTC ( [id://340967]=note: print w/replies, xml ) Need Help??


in reply to Dereferencing

$RESPONSE is a reference and it is basically a memory address. Now it's great to pass that around instead of copying the actual value which is one of the reasons people use it. Now, you can't just say something like $RESPONSE = 0 because that would assign the memory address of $RESPONSE to 0... not the actual value. So in order to dereference it (or in other words to use the actual value) you put a $ in the front. This basically says, I don't want the address, instead I want the value at that address. In your case you are assigning the value of 0 to it instead of getting a value. It works both ways.

Hope that helped. The docs are pretty good too, I just thought I would give a brief description.

Replies are listed 'Best First'.
Re: Re: Dereferencing
by flyingmoose (Priest) on Mar 30, 2004 at 19:32 UTC
    $RESPONSE is a reference and it is basically a memory address

    In interest of full-disclosure, it is not really a memory address, but basically like a memory address. I'm saying this for new-user benefit since MCS probably knows this. A reference is an entry in a symbol-table, if you like...not quite like C/C++ pointers. In Java, well, objects just act as references, so the line is blurred in a rather confusing way if that's where you are coming from.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://340967]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (6)
As of 2024-04-24 08:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found