Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^2: How to eliminate warning message on hash value?

by FloydATC (Chaplain)
on Dec 08, 2011 at 12:13 UTC ( #942407=note: print w/ replies, xml ) Need Help??


in reply to Re: How to eliminate warning message on hash value?
in thread How to eliminate warning message on hash value?

Funny, I was thinking the same.

$$keyptr = $$db{CurrentKey};
What exactly does this statement do? Mentally, I'm converting it to
$keyptr-> = $db->{CurrentKey};
which doesn't make any sense to me. What am I missing?

-- Time flies when you don't know what you're doing


Comment on Re^2: How to eliminate warning message on hash value?
Select or Download Code
Re^3: How to eliminate warning message on hash value?
by Marshall (Prior) on Dec 08, 2011 at 12:46 UTC
    Well $$keyptr dereferences presumably a pointer to the $key. This is fine if say X(\$key); sub X{$keyptr = shift} got called. Then $$keyptr = 3; would set $key to be 3 (just for example).

    As far as $$db{CurrentKey}, I figure that $db->{CurrentKey} is better although the other syntax is allowed.

    As to why the OP did this, I'm not quite sure. Passing a reference to a scalar is usually not necessary because Perl can return multiple values in a list. Normally if I modify your input scalar, I return it back as a modified value in a list. That is different than passing me a reference to an array where that might be some huge thing.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (8)
As of 2014-12-18 02:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (41 votes), past polls