Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re^3: hash question

by andal (Hermit)
on May 27, 2016 at 07:44 UTC ( #1164279=note: print w/replies, xml ) Need Help??


in reply to Re^2: hash question
in thread hash question

You are missing one slight catch. When you do

my $hash = shift;
you get pointer to the object passed to the function. When you do
$hash = {a => "alpha"};
you create new object and store its pointer in the variable that previously contained pointer to another object. Finally, when you do
%{ $hash } = ( a => 'alpha', b => 'beta' );
then you take object pointed by the variable and store in that object new set of keys.

You have to distinguish "objects" and "pointers to objects", the latter are called "references" in perl, then things may become more consistent for you.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2022-01-28 20:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:












    Results (73 votes). Check out past polls.

    Notices?