in reply to Confused on Scalar/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
|
|---|