Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4235304
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T02:28:50+00:00 2026-05-21T02:28:50+00:00

I believe my title may be a bit confusing, but here is the gist

  • 0

I believe my title may be a bit confusing, but here is the gist of what I am trying to do. I know this isn’t “the right way” to do this, I’m more just curious if it is possible.

So lets say I have the script:

#!/usr/bin/perl

use strict;
use warnings;

my $foo = "bar";
my $foo_location = int(\$foo);

print $foo_location;

The output of this will be something like, 136167064

How can I take that integer (the location of $foo in memory), and create another variable which is a reference to $foo, using that integer.

So what I’d want to do is something like:

my $foo_reference = some_magical_function_call($foo_location);

Which would allow modifying the dereference of $foo_reference, to modify the value of $foo. So after whatever magic allows this to work,

$$foo_reference eq $foo

Would evaluate to true

I want to say that I figured this out a couple of years ago, but maybe I’m crazy.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T02:28:51+00:00Added an answer on May 21, 2026 at 2:28 am

    Ah, yikes. I found the answer. I probably should have waited before posting this.

    Anyway, if anyone is curious:

    #!/usr/bin/perl
    use strict;
    use warnings;
    use B;
    
    
    my $foo = "bar";
    my $foo_location = int(\$foo);
    
    my $real_ref = bless(\(0+hex sprintf("%0x",$foo_location)), "B::AV")->object_2svref;
    
    print $$real_ref;
    

    Prints bar

    I figured this out from the answer to this question

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I believe this code may require more effort to comprehend than average, so I'm
dont really know if the title is apt but believe you will understand after
As the title says, I know what causes this error but I want to
I believe the title already says it all, but here is my question: what
Just as title says. I don't believe it is possible to do this but
I believe this question applies to any of the For Html helpers, but my
The title may seem a little weird but what I find around the internet
Typing out the title to this leads me to believe this might not be
The title isn't clear as I couldn't think of one but, I have an
Using XSL I am trying to turn this XML: <book><title>This is a <b>great</b> book</title></book>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.