go ahead... be a heretic | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Really the central problem was extending a one-dimensional hash to a two-dimensional one and then expecting the first-dimension's keys to remain scalars. Having extended the original hash into a hash of hashes, clearly the first-dimension's keys had to become hash-refs.(Emphasis was added by me.) Just a nit-pick that may prove useful in the future: hashes are made of key/value pairs, in which the key is something closer to a string than to a scalar, and the value is a scalar. In particular, the value can be a reference to a hash. Thus, there's no way to put a reference in the key value of a regular* Perl hash. The most you can have is that the "stringification" of a reference can be used as a hash key, but this is something different: you can't use the hash key to directly* access the reference any more using some obscure dark magic. * I'm using the words regular and directly because I'm sure that there will be someone pointing out that there are modules/ways to have a magical hash that has whatever key you want, and that you can access a reference even if all you have is a stringification! :D perl -ple'$_=reverse' <<<ti.xittelop@oivalf Io ho capito... ma tu che hai detto?In reply to Re^2: Why is my code assigning the last-retrieved value to all elements in my hash?
by polettix
|
|