How do I get a unique number to identify a reference? I could stringify it to something like "ARRAY(0x18045c0)", and then pull out the hex number with a regex, but I'm in a context where speed is a big deal. I was trying to do some magic with pack("P"), then unpack, but it's not working for me.
Oh yeah, it's gotta be portable, too. That is, the number itself can change from implementation to implementation, but in every environment it has to have the property of uniqueness. In particular, the Perl trick has to be work regardless of the integer and pointer sizes of the particular implementation.
(The reason I'm asking is I'm trying to do a Guttman-Rosler-Schwartz transform and some of the elements of the array I'm sorting are references to other arrays. I could put an arbitrary ID number in the subarrays as I create them and dereference the ID number for the sort, but I'm trying to save a few cycles. )