it's possible to alias a scalar to an element of a hash
DB<38> *y =\ $h{y} DB<39> $h{y}=666 DB<40> p $y 666 DB<41> $h{y}=42 DB<42> p $y 42
but I failed doing it the other way round. (i.e. $
Q1. Is it possible?
I could Tie::Hash the complete hash, but this would slow down all fetch operations on the hash, not only the aliased elements.
Q2. can I Tie::Scalar only a single element of a hash?
Thanks for insights! :)
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
FootballPerl is like chess, only without the dice
Sorry I'm stupid, my code already does what i wanted...
DB<53> $h{z}=111 DB<54> *z= \$h{z} DB<55> p $z 111 DB<56> $h{z}=222 DB<57> p $z 222 DB<58> $z=333 DB<59> p $h{z} 333
no not stupid, see my reply
In reply to Aliasing hash-element and scalar? by LanX
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |