Everything you suggest should work fine. Generally, a hash key is just a string, and can be anything that a string can be - it can even have null bytes in it. I don't remember right now, but it is possible that a 32-bit build of perl may be limited to strings of length 2^32-1 and therefore to hash keys of that length. A 64-bit build should in any case be able to support strings up to length 2^64-1 (if you have that much memory).

If you provide the key as a literal in your perl code, you will need to take the same care to quote it correctly as you would using it as a string.

If you provide something that isn't a string then it will be coerced to a string to make the key, the same as if you were printing it. If it was an object, that means you won't be able to get back the object reference from looking at the key; if it was a number, you won't necessarily get the identical number back, at least not to the same precision.


In reply to Re: Potential hash key ids limitations by hv
in thread Potential hash key ids limitations by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.