I see it as the same issue because "string value" doesn't have (much of) a place in the nomenllature of Perl. I mean in typical usage; in the docs; in tutorials an well-known books. People are educated to think of $var as a scalar (which is a scalar etc.), and then when they use a reference as a hash key it loses its magic and they are suprised.
There are other places where stringification occurs. For example, if you create a file from a variable that holds a reference, and then use readdir to attempt to recover it, obviously it's going to lose its magic. I don't think that suprises anyone as much <g> but that's precisely because you are unPerlifying your data.
I take back my claim about the genesis of string-only hash keys. You're right: I don't know how the decision was made either. We both recognize simplicity; my gripe was about consistency (which, when lacking, often causes loss of simplicity elsewhere).
(Paranthetically: in Java, references can be hash keys. Of course, Java hashes are nowhere near as elegant to use as in Perl, so I don't know whose point of view this supports. Then again I think we've more or less come to see eye to eye on this, no?)
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.