http://www.perlmonks.org?node_id=597462


in reply to Aliasing one hash to another

You should just fix the offending code. Modifying a global hash is a bad practice. If for some reason this is not possible then you can use a glob to alias the second hash temporarily.. but this is bad mojo and should be avoided.
use strict; use warnings; use Data::Dumper; use vars qw( %hash1 %hash2 ); %hash1 = (a => 1); %hash2 = (b => 2); do_badness(); print "hash1: ", Dumper \%hash1; print "hash2: ", Dumper \%hash2; sub do_badness { local *hash1 = \%hash2; bad_sub(); } sub bad_sub { $hash1{c} = 3; }