|Don't ask to ask, just ask|
Re: Why was it neccessary to pass a DBI handler by reference?by neuroball (Pilgrim)
|on Jan 28, 2004 at 15:54 UTC||Need Help??|
It's one of the good/bad things about perl. You get what you ask for.
When you passed your handler just through the variable, I.e. $dbh, you passed the scalar value of $dbh to the hash.
When you passed your handler through a reference, i.e. \$dbh, you passed the memory position of your handler to the hash
So, in the first case you have a scalar value, which is in no way connected to the handler, and in the second case you have a memory address which gives you access to the handler.
It's the strange thing about references. I always make a note in my mind that my finger, which points at the moon, isn't the moon. Yet, if you followed the direction my finger is pointing at, you would surely find the moon.
Sorry when the finger/moon analogy is a bit fuzzy.
Hans: Not ze problem!