in reply to Re^2: Unique numeric ID for reference?
in thread Unique numeric ID for reference?

refaddr() is also provided by the non-XS version, and essentially does extract the numeric part of a stringified reference and returns its decimal value. It is slower than the XS version, though.

--shmem

_($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                              /\_¯/(q    /
----------------------------  \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}

Replies are listed 'Best First'.
Re^4: Unique numeric ID for reference?
by Jeffrey Kegler (Hermit) on Oct 06, 2007 at 23:02 UTC
    I just looked at the code for Scalar::Util and the non-XS version of refaddr does a stringify, then a regex match to pull out the hex number. Simply putting an arbitrary unique ID into my records and dereferencing it isn't all that expensive, so I think that's going to have to be my answer.

    Since I'm doing pack, unpack hacks for the Guttman-Rosler-Schwartz transform, I was hoping for some pack/unpack wizardry. But if Graham Barr didn't use that kind of wizardry in Scalar::Util, that's very good evidence there is no such thing.

    thanks, jeffrey kegler

Re^4: Unique numeric ID for reference?
by Jeffrey Kegler (Hermit) on Oct 06, 2007 at 22:49 UTC
    I think you're right. Either refaddr is the answer to my question, or else there really isn't one.

    I'll check out the non-XS version for speed.

    Many thanks for your persistence in pointing me in the right direction,

    jeffrey kegler