Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Confused on Scalar/Hash

by LanX (Saint)
on Apr 02, 2018 at 15:41 UTC ( [id://1212175]=note: print w/replies, xml ) Need Help??


in reply to Confused on Scalar/Hash

I personally understand %hash as the "list form" of a hash.

You assign lists and you get lists of elements.

i.e. %hash2 = %hash will copy the lists of key-value pairs into a new hash.

$hash_ref = \%hash is a pointer to the container.

$hash_ref2 = $hash_ref will share the same hash.

changing $hash_ref2->{a}++ will also effect $hash_ref

Many other languages only know the reference form. Like in JS hash={...} is a hash_ref.

HTH!

Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)
Wikisyntax for the Monastery

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (6)
As of 2024-04-19 15:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found