Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

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

by neuroball (Pilgrim)
on Jan 28, 2004 at 16:30 UTC ( [id://324701]=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?

Hm... following the logic of the above (if I am not mistaken): I am (a) wrong, and (b) kudra needed to have a reference to a reference???

Not to be a pain in your neck, but could you explain a bit more what you meant? For example, take the following code:

#!/usr/local/bin/perl use warnings; use diagnostics; use strict; my $x = "Just another scalar"; my $y = \$x; print $x."\n"; print $y."\n";

Am i totally of base with this??? Or am I missing something very basic?

/oliver/

Replies are listed 'Best First'.
Re: Why was it neccessary to pass a DBI handler by reference?
by Abigail-II (Bishop) on Jan 28, 2004 at 17:00 UTC
    kudra needed to have a reference to a reference???
    Maybe, maybe not. I can't make heads nor tails from kudra's posting. Some vital information, namely the code in the modules One and Two is missing. I'm not going to speculate what's going on.
    For example, take the following code:
    Your code produces:
    Just another scalar SCALAR(0x8191618)
    But what about it? Why do you post that code. Does the result surprise you? Are you trying to make a point?
    but could you explain a bit more what you meant?
    What I meant was every reference is a scalar. There are no exceptions to this rule. What I also meant was that the $dbh in kudra's original post is also very likely to be a reference. Your post seem to imply that you think scalars and references are different things. So, I have two points: 1) references are scalars. 2) in both forms, a reference is passed as second argument to the news anyway.

    Abigail

Re: Re: Re: Why was it neccessary to pass a DBI handler by reference?
by revdiablo (Prior) on Jan 28, 2004 at 18:53 UTC
    Or am I missing something very basic?

    I think you might be conflating a stringified scalar reference with scalars in general. Scalars in Perl are single-value entities. A string is stored as a scalar. A reference is stored as a scalar. These bear no inherent relation to eachother, though. One can have [among other things] (1) a plain string, or (2) a reference to a string, or (3) a reference to something else. All of these are scalars. Only (2) would necessarily print "SCALAR(...)" when stringified, though -- that is a reference thing, not a scalar thing. (I say 'necessarily' because while (3) might print "SCALAR(...)", it could also print "ARRAY(...)", "HASH(...)", or any number of other things, depending on what it's a reference to.)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (11)
As of 2024-03-28 09:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found