my %refs; $str= pack( "N", 0+$ref ); $refs{0+$ref}= $ref; #### $ref= $refs{unpack("N",$str)};