It depends on just what you want to do with the keys of your hash.
As you see, all hash keys are stringified, so the keys can never again be used as references (the original references are unaffected). However, they are stringified uniquely because each reference has a unique address, so I see no problem with using the string representation to flag that a particular array has been handled.
Of course, if the referent of a reference is destroyed, the hash key corresponding to it is unaffected! You have to take care of this on your own. And remember: if references are destroyed and new ones created, old reference addresses may be re-used!
Actually, I think I would tend to use something like bluestar's suggestion in Re: Reference as a hash key: it's more general and flexible, probably more maintainable.
Updates:
-
Added note about reference destruction.
-
Added endorsement of bluestar's suggestion.
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.