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

  • Home
  • SEARCH
  • 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 6608317
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T19:35:49+00:00 2026-05-25T19:35:49+00:00

I have two packages. There is one hash in one package. I want to

  • 0

I have two packages. There is one hash in one package. I want to pass this hash to a method in another package, manipulate it and see the results in the previous package. Here’s my code:
{

package Statistical_Analysis;
use Moose;
our $data;
our $ref;
our $k;
our $v;
sub countUseCase
{
    my ($self, $value, $hash) = @_;
    print "Passed value: ".$value."\n";
    print "Hash Address: ".$hash."\n";
    $self->{ref} = $hash;
    $self->{%$ref}{'country'} = "something";
    #print "IP Address: ".$self->{data}."\n";
    #print "Hash Value: ".$self->{ref{'ip_count'}}."\n";
}

}

{
package Parse;
use Moose;
our %ip_address;
sub getFields
{
    our $stanalyze_obj = Statistical_Analysis->new();
       my $ref = \%ip_address;
       $stanalyze_obj->countUseCase($ref);
       dispHashMap();
}

sub dispHashMap
{
    print \%ip_address."\n";
    while ( my ($k,$v) = each %ip_address )
    {
     print "$k => $v\n";
    }

}

But I cant see the changes in the hash. Any help?

  • 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-25T19:35:49+00:00Added an answer on May 25, 2026 at 7:35 pm

    You don’t see any change because you never change it. Since it makes no sense, I presume you meant to change the $ip_address{country} when you do

     $self->{%$ref}{'country'} = 'something';
    

    If so, that should be

     $hash->{country} = 'something';
    

    Of course, $hash is stored in $self->{ref}, so you could also use

     $self->{ref}->{country} = 'something';
    

    which can be shortened to

     $self->{ref}{country} = 'something';
    

    PS — What’s with all the our variables? You should almost never have to use our. @ISA and @EXPORT_OK are about the only uses I can think of. All of those should be my.

    PSS — Actually, almost none of those should exist at all. What’s with declaring variables you don’t even use? One of these declarations is making your error a lot less obvious.

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

Sidebar

Related Questions

I have two classes, each in a different packages and there is a one-to-many
In Eclipse I have two projects with the same package structure. In one of
I have two tables in a database, one lists package and one lists dependencies:
I have two Python packages where one needs to be imported by the other.
I have two packages installed with the same name, one globally and one locally
I have two activities with same name on two different packages. One is just
I am evaluating datamining packages. I have find these two so far: RapidMiner Weka
I have these two modules : package G1; sub new { my $class =
I have two enums, in two packages. I could have 1000 enums, un 1000
I have two nested packages that I am calling via fast_cgi. From the first

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.