sub a { my $ref = shift; my %c = %$ref; $c{a} = 'a'; } sub b { my $c = shift; $$c{b} = 'b'; } my %c; &a(\%c); &b(\%c); print foreach (keys %c);