I have a hash, which is filled up with data. I add it to an array. Then, I want to modify my hash, but make sure that what is in the array remains untouched. I'm trying this, doesn't work:
my @a;
my %h;
%h{foo} = 1;
push(@a, \%x);
%h = (); # here I clean the hash up
# but I want the array to still contain the data
I feel that I need to make a copy of it before adding to the array. How? I don't need a deep copy, my hash contains only strings.