I am trying to pass reference of a hash into a subroutine defined in another module in order to increase performance. In the subroutine in this other module reference is dereferenced as:
sub subRoutine{
my $hash_ref = $_[0];
my %hash = %$hash_ref;
$hash{$a_key} = $a_value;
}
So this changes the value of that key in this module BUT it doesn't change the value in the perl program where this subroutine is called. What is the reason and how can I avoid this? Is it correct to use references instead of passing hashed/returning hashed in order to improve performance?
Thanks in advance! Best wishes!