use Data::Dumper; use strict; use warnings; my %h = ( foo => 1 ); { local $h{'foo'} = 2; print Dumper \%h; } print Dumper \%h;