Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Re: Why was it neccessary to pass a DBI handler by reference?

by MCS (Monk)
on Jan 30, 2004 at 06:29 UTC ( [id://325149]=note: print w/replies, xml ) Need Help??


in reply to Re: Why was it neccessary to pass a DBI handler by reference?
in thread Why was it neccessary to pass a DBI handler by reference?

Sorry, my understanding was incorrect. The way I (incorrectly) understood it was that $y was a scalar representation of the reference \$x. (In the example: "my $y = \$x;") I then thought that when you dereferenced it, it converted it back into a reference.

Of course, I guess this is sortof how it works, in that \$x must figure out the address of x and return it so in a way it almost acts like a function. So \$x is basically a function with the parameter $x that returns the address of $x. (as a scalar of course) But then again \ isn't really a function, I imagine it interprets whatever follows it at runtime. However, I'm not about to start digging around the perl code to see exactly how it works.

  • Comment on Re: Re: Why was it neccessary to pass a DBI handler by reference?

Replies are listed 'Best First'.
Re: Why was it neccessary to pass a DBI handler by reference?
by Abigail-II (Bishop) on Jan 30, 2004 at 08:42 UTC
    Of course, I guess this is sortof how it works, in that \$x must figure out the address of x and return it so in a way it almost acts like a function.
    No, this is Perl, not C. A reference is a reference, and not a pointer. There are pointers involved in the internals, but pointers are used for other scalar types as well.

    Abigail

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (3)
As of 2024-06-25 07:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.