memory - How can I make a Perl variable reference another variable by its integer reference -


I believe my title may be a bit confusing, but here's what I'm trying to do I am I know that this is not "the right way" to do this, I'm probably curious if this is possible.

Say that I have a script:

  #! Strict use of USR / Bin / Pearl; Use warnings; My $ foo = "bar"; My $ foo_location = int (\ $ foo); Print $ foo_location;   

This kind of output will be something like 136167064

How can I get that integer ($ foo in memory), and make another variable $ A reference to Foo, using that integer.

So what I want to do is something like this:

  my $ foo_reference = some_magical_function_call ($ foo_location);   

The deviation of $ foo_reference will be allowed to modify, which will modify the value of $ foo, so whatever magic it allows to work,

  $$ foo_reference eq $ foo   

Evaluate the truth

I want to say that I thought it a few years ago, but maybe I'm crazy Ho.

Ah, oops I got the answer. I should have probably had to wait before posting it.

However, if someone is curious:

  #! Use / usr / bin / perl strict; Use warnings; Use B; My $ foo = "bar"; My $ foo_location = int (\ $ foo); My $ real_ref = Blessing (\ (0 + Hex Sprintoff ("% 0x", $ foo_location), "B :: AV") - & gt; Object_2 esf; Print $$ real_off;   

print bar

I responded by answering

Comments